Closed lpinca closed 3 years ago
Anyway url-parse
does not do any validation:
> parse('file://host:123/foo/bar/baz')
{
slashes: true,
protocol: 'file:',
hash: '',
query: '',
pathname: '/foo/bar/baz',
auth: '',
host: 'host',
port: '',
hostname: 'host',
password: '',
username: '',
origin: 'null',
href: 'file://host/foo/bar/baz'
}
The Node.js WHATWG URL parser throws an error for the same URL:
> new URL('file://host:123/foo/bar/baz')
Uncaught TypeError [ERR_INVALID_URL]: Invalid URL
at __node_internal_captureLargerStackTrace (node:internal/errors:463:5)
at new NodeError (node:internal/errors:370:5)
at onParseError (node:internal/url:536:9)
at new URL (node:internal/url:612:5) {
input: 'file://host:123/foo/bar/baz',
code: 'ERR_INVALID_URL'
Fixes: https://github.com/unshiftio/url-parse/pull/209#issuecomment-886235848