Closed lpinca closed 3 years ago
this is causing issues. let's say I have a path file:://file-path/file.png
after parsing the href
prop is returning file:///file-path/file.png
notice the third slash after the protocol.
@enahum I see that the Node.js URL parser handles this differently
new URL('file://file-path/file')
URL {
href: 'file://file-path/file',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: 'file-path',
hostname: 'file-path',
port: '',
pathname: '/file',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
but the issue it not caused by this commit. This behavior was introduced with d2979b586d8c7751e0c77f127d9ce1b2143cc0c9. I'll see if I can fix it.
Anyway this is kind of funny:
> new URL('file:file-path/file')
URL {
href: 'file:///file-path/file',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '/file-path/file',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
> new URL('file:/file-path/file')
URL {
href: 'file:///file-path/file',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '/file-path/file',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
> new URL('file://file-path/file')
URL {
href: 'file://file-path/file',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: 'file-path',
hostname: 'file-path',
port: '',
pathname: '/file',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
> new URL('file:///file-path/file')
URL {
href: 'file:///file-path/file',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '/file-path/file',
search: '',
searchParams: URLSearchParams {},
hash: ''
}
I wonder if a file:
url can have a host
.
@enahum https://github.com/unshiftio/url-parse/pull/210 should fix the issue.
Published as 1.5.3
Fixes https://github.com/unshiftio/url-parse/pull/208#discussion_r675788224.