diff --git a/url/Cargo.toml b/url/Cargo.toml index a9dfa16ef..969706d92 100644 --- a/url/Cargo.toml +++ b/url/Cargo.toml @@ -2,7 +2,7 @@ name = "url" # When updating version, also modify html_root_url in the lib.rs -version = "2.4.0" +version = "2.4.1" authors = ["The rust-url developers"] description = "URL library for Rust, based on the WHATWG URL Standard" diff --git a/url/src/lib.rs b/url/src/lib.rs index 3f2788cf2..58c7c07cd 100644 --- a/url/src/lib.rs +++ b/url/src/lib.rs @@ -134,7 +134,7 @@ url = { version = "2", features = ["debugger_visualizer"] } */ -#![doc(html_root_url = "https://docs.rs/url/2.4.0")] +#![doc(html_root_url = "https://docs.rs/url/2.4.1")] #![cfg_attr( feature = "debugger_visualizer", debugger_visualizer(natvis_file = "../../debug_metadata/url.natvis") diff --git a/url/src/parser.rs b/url/src/parser.rs index d5ae8314c..7d94d1d71 100644 --- a/url/src/parser.rs +++ b/url/src/parser.rs @@ -1202,6 +1202,7 @@ impl<'a> Parser<'a> { _ => { self.check_url_code_point(c, &input); if scheme_type.is_file() + && self.serialization.len() > path_start && is_normalized_windows_drive_letter( &self.serialization[path_start + 1..], ) diff --git a/url/tests/unit.rs b/url/tests/unit.rs index 6cb0f37fe..c27f237ba 100644 --- a/url/tests/unit.rs +++ b/url/tests/unit.rs @@ -472,7 +472,7 @@ fn append_trailing_slash() { fn extend_query_pairs_then_mutate() { let mut url: Url = "http://localhost:6767/foo/bar".parse().unwrap(); url.query_pairs_mut() - .extend_pairs(vec![("auth", "my-token")].into_iter()); + .extend_pairs(vec![("auth", "my-token")]); url.check_invariants().unwrap(); assert_eq!( url.to_string(), @@ -1298,3 +1298,11 @@ fn test_file_with_drive_and_path() { let url2 = url::Url::join(&url, s2).unwrap(); assert_eq!(url2.to_string(), "file:///p:/a"); } + +#[test] +fn issue_864() { + let mut url = url::Url::parse("file://").unwrap(); + dbg!(&url); + url.set_path("x"); + dbg!(&url); +}