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 8, 2021
1 parent b4a8375 commit 3190e7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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
3 changes: 3 additions & 0 deletions lib_test/test_runner.ml
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ 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
let pp_option pp ppf = function Some x -> Format.fprintf ppf "%a" pp x | None -> () in
assert_equal ~printer:(Format.asprintf "%a" (pp_option Format.pp_print_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 3190e7c

Please sign in to comment.