servo / servo/rust-url

Question: Why are Windows local device paths not supported?

Open
#720 1 comment 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

I noticed the following behaviour in the unit tests:

// Paths starting with "\\.\" (Local Device Paths) are intentionally not supported.
let url = Url::from_file_path(Path::new(r"\\.\some\path\file.txt"));
assert!(url.is_err());

However, I can't find any discussion of this in the PR (#360) or its predecessor (#284). Why are they not supported?

I don't actually have a need for this to change; I'm just trying to survey the behaviour of URL libraries and applications. Since there is an actual test for this with an explicit comment, I expect that support was considered but deemed unsuitable for some reason?

Additionally, I noticed that the reverse is not true - this library will take a URL like file://./some/path/file.txt and turn it in to a local device path (\\.\some\path\file.txt). You may need to explicitly set the host to ".", as IIRC Url::parse stripped it for some reason.

I realise that the PR which introduced this is 5 years old, so perhaps nobody remembers the reason. Still, any information you do remember would be much appreciated. Thanks!

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 the Windows path test in url/tests/unit.rs around line 745, then review PRs #360 and #284 for the historical rationale. Compare the stated behavior with the reverse conversion described in the issue; done means confirming the reason for the limitation and recording a clear explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.