Pathname setter (set_path) not like WHATWG definition for cannot-be-a-base-URL
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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