- From: Daijiro Wachi <notifications@github.com>
- Date: Tue, 08 Sep 2020 03:02:59 -0700
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 8 September 2020 10:04:37 UTC
## Steps to reproduce
The below `console.log` should show the same result.
```js
const hash = 'test\x00';
const url = new URL(`http://a.com/#${hash}`)
console.log(url.href)
// => http://a.com/#test
url.hash = hash
console.log(url.href)
// => http://a.com/#test%00
```
## Summary
Because the basic URL parser removes trailing c0 control or space only when `url` is not given, it makes a difference with override.
Refs: https://url.spec.whatwg.org/#url-parsing
```
1. If url is not given:
1.Set url to a new URL.
2. If input contains any leading or trailing C0 control or space, validation error.
3. Remove any leading and **trailing C0 control or space** from input.
```
Potential solutions would be below two:
1. Allows basic URL parser to use c0 control or space
2. Remove c0 control or space always
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/542
Received on Tuesday, 8 September 2020 10:04:37 UTC