Skip to content

Do not remove newline and tab characters #419

@demurgos

Description

@demurgos

The current spec requires to produce a validation error if a newline or tab is encountered, and remove them from the input:

url/url.bs

Lines 1472 to 1474 in 49060c7

<li><p>If <var>input</var> contains any <a>ASCII tab or newline</a>, <a>validation error</a>.
<li><p>Remove all <a>ASCII tab or newline</a> from <var>input</var>.

This contradicts the behavior observed in Firefox, Chrome and Edge:

const url = new URL("http://www.example.com/")
url.pathname = 'foo\nbar';
url.href
  • Node and WHATWG URL: "http://www.example.com/foobar"
  • Firefox, Chrome and Edge: "http://www.example.com/foo%0Abar"
const url = new URL("http://www.example.com/")
url.pathname = 'foo\tbar';
url.href
  • Node and WHATWG URL: "http://www.example.com/foobar"
  • Firefox, Chrome and Edge: "http://www.example.com/foo%09bar"

This issue was originally reported for Node: nodejs/node#23696
Removing these characters prevents the use of file:// urls to represent files with newlines and tabs in their path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions