servo / servo/rust-url

Disabling "remove dot segments" behavior

Open
#874 3 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

I have a use-case where I need to be able to construct URLs that end in …/. or …/..[^1]; however, the url crate insists on removing dot segments no matter what API I go through, even when the dots are percent-escaped, e.g.:

fn main() {
    let url = url::Url::parse("https://example.com/path/%2e%2e").unwrap();
    // Prints "https://example.com/":
    println!("{url}");
}

Is there currently a method to construct a URL like this using this crate? If not, could such a method be added?

[^1]: Specifically, this is for manipulating GitHub labels via the GitHub REST API; if a user names a label with dot or dot-dot, the URL ends up with dots at the end.

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 Url::parse entry point and compare its behavior with RFC 3986 section 5.2.4, linked in the issue. Determine whether the crate already exposes a way to preserve trailing dot segments and what API shape is needed if it does not. Done means a supported construction path can retain URLs ending in /. or /.., with the behavior covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.