servo / servo/rust-url

Incorrect parsing of Windows drive letter quirk

Open
#889 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.6k
Forks
406
PR merge metrics
No merged PRs in 30d

Description

  • Note that this crate implements the URL Standard not RFC 1738 or RFC 3986

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Parser::parse_file_host and Parser::file_host, then compare their behavior with the URL Standard's file host state. Add a regression test for parsing file:///C|/hello/world and verify that the serialized URL is file:///C:/hello/world.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.