Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow @ on scheme part #155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Disallow @ on scheme part #155

wants to merge 1 commit into from

Conversation

dinosaure
Copy link
Member

A simple fix to disallow @ on scheme according to RFC 3986. We need a REVDEP to be sure to not break anything.

Copy link
Contributor

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like adding support for the "scp syntax" to the library. Perhaps this should be documented somewhere ?

scp man page:

a remote host with optional path in the form [user@]host:[path]

Git calls it "scp-like syntax": https://git-scm.com/docs/git-clone#_git_urls but with a special case:

This syntax is only recognized if there are no slashes before the first colon. This helps differentiate a local path that contains a colon

@@ -422,6 +422,8 @@ let test_with_change = [
let urn = Uri.of_string "urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6" in
let urn2= Uri.with_scheme urn (Some "urn") in
assert_equal ~printer urn urn2;
let git = Uri.of_string "[email protected]:owner/repo" in
assert_equal ~printer:Fmt.(to_to_string (option string)) (Uri.scheme git) None ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The path of user@host:50/repo should be 50/repo. Can you add a test to make sure it isn't picked as the port number ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would indeed allow me to use it in dune-release !

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All information move as a path part of the given Uri.t. Again, this PR does not want to fix your initial issue but it wants to respect a little better the RFC (and disallow @ as a possible character of the scheme part). If you really want to accept and understand something like [email protected]:owner/repo, you should take a look on emile - with a split on : - which one best fits your case.

lib_test/dune Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants