Skip to content

Commit 80facc2

Browse files
committed
Disallow @ on scheme part
1 parent b4a8375 commit 80facc2

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lib/uri.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ module Parser = struct
892892
let scheme =
893893
lift
894894
(fun s -> Some (Pct.decode (Pct.cast_encoded s)))
895-
(take_while (fun c -> c <> ':' && c <> '/' && c <> '?' && c <> '#')
895+
(take_while (fun c -> c <> '@' && c <> ':' && c <> '/' && c <> '?' && c <> '#')
896896
<* char ':')
897897
<|> return None
898898

lib_test/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(name test_runner)
33
(package uri)
44
(modules test_runner)
5-
(libraries uri uri.services oUnit))
5+
(libraries fmt uri uri.services oUnit))
66

77
(test
88
(name test_runner_sexp)

lib_test/test_runner.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ let test_with_change = [
422422
let urn = Uri.of_string "urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6" in
423423
let urn2= Uri.with_scheme urn (Some "urn") in
424424
assert_equal ~printer urn urn2;
425+
let git = Uri.of_string "[email protected]:owner/repo" in
426+
assert_equal ~printer:Fmt.(to_to_string (option string)) (Uri.scheme git) None ;
425427

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

0 commit comments

Comments
 (0)