servo / servo/rust-url

Pathname setter (set_path) not like WHATWG definition for cannot-be-a-base-URL

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

According to WHATWG (https://url.spec.whatwg.org/#dom-url-pathname) the pathname setter should return without changing the URL if the cannot-be-a-base-URL flag is set but set_path() is setting the given path.

The following code example (from https://github.com/web-platform-tests/wpt/blob/master/url/resources/setters_tests.json) is showing this:

let mut url = Url::parse("mailto:me@example.net").unwrap();
url.set_path("/foo");
assert_eq!(url.cannot_be_a_base(), true);
assert_eq!(url.as_str(), "mailto:me@example.net");

The actual result is "mailto:%2Ffoo".

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 set_path() implementation and compare its behavior with the WHATWG URL pathname setter and the linked web-platform-tests example. Run the mailto:me@example.net reproduction; done means set_path("/foo") leaves cannot_be_a_base() true and the serialized URL unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.