fixed the handling for paths in the form of "\\?\C:\..."
@@ -1084,6 +1084,7 @@ fn path_to_file_url_path_windows(path: &Path) -> Result<Vec<String>, ()> {
let disk = match components.next() {
Some(Component::Prefix(ref p)) => match p.kind() {
Prefix::Disk(byte) => byte,
+ Prefix::VerbatimDisk(byte) => byte,
_ => return Err(()),
},
@@ -69,6 +69,10 @@ fn new_path_windows_fun() {
// Invalid UTF-8
url.path_mut().unwrap()[2] = "ba%80r".to_string();
assert!(url.to_file_path().is_err());
+
+ // test windows canonicalized path
+ let path = PathBuf::from(r"\\?\C:\foo\bar");
+ assert!(Url::from_file_path(path).is_ok());
}