servo / servo/rust-url

Behaviour of `Url::join` for Paths Starting with a Windows Drive Letter

Open
#769 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

Describe the bug

The following code I think demonstrates a potentially inconsistent treatment of paths starting with windows drive letters. In particular it is sort of treated like an absolute path, in that it overrides any path in the base url, but it is also doesn't behave like an absolute path either.

let root = Url::parse("file:///").unwrap();
println!("{}", root.join("foo").unwrap()); // file:///foo
println!("{}", root.join("/foo").unwrap()); // file:///foo
println!("{}", root.join("c:/foo").unwrap()); // c:/foo
println!("{}", root.join("/c:/foo").unwrap()); // file:///c:/foo

let root = Url::parse("file:///fiz/buz/").unwrap();
println!("{}", root.join("foo").unwrap()); // file:///fiz/buz/foo
println!("{}", root.join("/foo").unwrap()); // file:///foo
println!("{}", root.join("c:/foo").unwrap()); // c:/foo
println!("{}", root.join("/c:/foo").unwrap()); // file:///c:/foo

Looking at the standard I think c:/foo should be being interpreted as a path-relative-scheme-less-URL string which doesn't indicate that it should be treated differently from any other relative path just because it starts with a drive letter. That being said I definitely could be missing 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 at the Url::join entry point and reproduce the examples using Windows drive-letter paths. Compare the results with the WHATWG URL writing and path-relative scheme-less URL rules linked in the issue; done means the behavior is consistent with the selected specification and covered by regression tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.