Open
Description
Url.to_file_path()
doesn't produce a UNC path on Windows, even when the Url was initialized with a UNC path via Url.from_file_path()
. Thus this program:
extern crate url;
use std::path::Path;
use url::Url;
fn main() {
let unc_path = Path::new(r"\\?\C:\Windows\System");
let url = Url::from_file_path(unc_path).expect("url");
let abs_path_buf = url.to_file_path().expect("path");
let abs_path = abs_path_buf.as_path();
assert_eq!(unc_path, abs_path);
}
Fails with:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `"\\\\?\\C:\\Windows\\System"`,
right: `"C:\\Windows\\System"`', src\main.rs:11:2
It seems like Url.to_file_path()
should produce a UNC path, at least when the Url was initialized with one; and perhaps in all cases, for compatibility with std::fs::canonicalize(), which always produces UNC paths on Windows (although this is controversial, per rust-lang/rust#42869).