diff --git a/src/lib.rs b/src/lib.rs index 70e030fd..9caffad0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1084,6 +1084,7 @@ fn path_to_file_url_path_windows(path: &Path) -> Result, ()> { let disk = match components.next() { Some(Component::Prefix(ref p)) => match p.kind() { Prefix::Disk(byte) => byte, + Prefix::VerbatimDisk(byte) => byte, _ => return Err(()), }, diff --git a/tests/tests.rs b/tests/tests.rs index 45c403db..11d35cde 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -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()); } }