servo / rust-url

URL parser for Rust
https://docs.rs/url/
Apache License 2.0
1.31k stars 325 forks source link

Incorrect parsing of Windows drive letter quirk #889

Open GabrielDertoni opened 9 months ago

GabrielDertoni commented 9 months ago

Description The following test case fails

let u = Url::parse("file:///C|/hello/world").unwrap();
assert_eq!(u.as_str(), "file:///C:/hello/world");

Playground link

According to the specification, it appears to me that this test case should pass. Currently the result given by the parser will be "file:///C|/hello/world" (without the '|' to ':' conversion). Looking at the implementation Parser::parse_file_host ignores the bool returned by Parser::file_host, which indicates the branch specified in file host state.1. This results in the error described.

Please let me know if this is indeed an issue with the implementation or if I've missed something.