Skip to content

Commit

Permalink
Disallow @ on scheme part
Browse files Browse the repository at this point in the history
  • Loading branch information
dinosaure committed Apr 6, 2021
1 parent b4a8375 commit 80facc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/uri.ml
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ module Parser = struct
let scheme =
lift
(fun s -> Some (Pct.decode (Pct.cast_encoded s)))
(take_while (fun c -> c <> ':' && c <> '/' && c <> '?' && c <> '#')
(take_while (fun c -> c <> '@' && c <> ':' && c <> '/' && c <> '?' && c <> '#')
<* char ':')
<|> return None

Expand Down
2 changes: 1 addition & 1 deletion lib_test/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(name test_runner)
(package uri)
(modules test_runner)
(libraries uri uri.services oUnit))
(libraries fmt uri uri.services oUnit))

(test
(name test_runner_sexp)
Expand Down
2 changes: 2 additions & 0 deletions lib_test/test_runner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 "git@github.com:owner/repo" in
assert_equal ~printer:Fmt.(to_to_string (option string)) (Uri.scheme git) None ;

let urn_path =
Uri.with_path Uri.empty "uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"
Expand Down

0 comments on commit 80facc2

Please sign in to comment.