Closed
Description
Hi there, I'm using this library to parse URLs with a custom protocol like so:
my-custom-protocol:///path-to/image.jpg
The behaviour has changed in v1.5.0 so that part of the pathname is being treated as the host. I believe this is a bug and goes against the browser implementation of URL
, which produces a similar output similar to v1.4.7 with the hostname
unset. I think it's due to the change in regex match here.
Output in v1.4.7:
{
slashes: true,
protocol: 'my-custom-protocol:',
hash: '',
query: '',
pathname: '/path-to/image.jpg',
auth: '',
host: '',
port: '',
hostname: '',
password: '',
username: '',
origin: 'null',
href: 'my-custom-protocol:///path-to/image.jpg'
}
Output in v1.5.0:
{
slashes: true,
protocol: 'my-custom-protocol:',
hash: '',
query: '',
pathname: '/image.jpg',
auth: '',
host: 'path-to',
port: '',
hostname: 'path-to',
password: '',
username: '',
origin: 'my-custom-protocol://path-to',
href: 'my-custom-protocol://path-to/image.jpg'
}
Let me know if you need any more details. Thanks!
Metadata
Metadata
Assignees
Labels
No labels