Skip to content

Commit

Permalink
Merge pull request #58 from mre/file-without-host
Browse files Browse the repository at this point in the history
Don't require host for `file` scheme
  • Loading branch information
robinst committed Jun 24, 2023
2 parents 58528a4 + 786fa8e commit c492f01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn find_scheme_start(s: &str) -> (Option<usize>, Option<char>) {
/// We could make this configurable, but let's keep it simple until someone asks (hi!).
fn scheme_requires_host(scheme: &str) -> bool {
match scheme {
"https" | "http" | "file" | "ftp" | "ssh" => true,
"https" | "http" | "ftp" | "ssh" => true,
_ => false,
}
}
Expand Down
2 changes: 2 additions & 0 deletions tests/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ fn authority() {
assert_not_linked("file:// ");
assert_not_linked("\"file://\"");
assert_not_linked("\"file://...\", ");
assert_linked("file://somefile", "|file://somefile|");
assert_linked("file://../relative", "|file://../relative|");
assert_linked("http://a.", "|http://a|.");
}

Expand Down

0 comments on commit c492f01

Please sign in to comment.