Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error result when url using custom protocol in browser #147

Open
loynoir opened this issue Aug 8, 2021 · 4 comments
Open

Error result when url using custom protocol in browser #147

loynoir opened this issue Aug 8, 2021 · 4 comments

Comments

@loynoir
Copy link

loynoir commented Aug 8, 2021

Test in browser

t.is(normalizeUrl('sindre://www.sorhus.com'), 'sindre://sorhus.com');

Expected

normalizeUrl=(await import('https://cdn.jsdelivr.net/npm/normalize-url@7.0.1/index.js')).default
normalizeUrl('sindre://www.sorhus.com')
"sindre://www.sorhus.com"

Actual

normalizeUrl=(await import('https://cdn.jsdelivr.net/npm/normalize-url@7.0.1/index.js')).default
normalizeUrl('sindre://www.sorhus.com')
"sindre:/www.sorhus.com"

Related rejected fork

https://github.com/loynoir/normalize-url

@loynoir
Copy link
Author

loynoir commented Aug 8, 2021

Related: Can I use version 7 in the browser?
#140

@loynoir
Copy link
Author

loynoir commented Aug 8, 2021

Node

> new URL("sindre://www.sorhus.com").protocol
'sindre:'
> new URL("sindre://www.sorhus.com").host
'www.sorhus.com'
> new URL("sindre://www.sorhus.com").pathname
''

Google Chrome 92

> new URL("sindre://www.sorhus.com").protocol
"sindre:"
> new URL("sindre://www.sorhus.com").host
""
> new URL("sindre://www.sorhus.com").pathname
"//www.sorhus.com"

Mozilla Firefox 90

> new URL("sindre://www.sorhus.com").protocol
"sindre:"
> new URL("sindre://www.sorhus.com").host
""
> new URL("sindre://www.sorhus.com").pathname
"//www.sorhus.com"

loynoir added a commit to loynoir/normalize-url that referenced this issue Aug 9, 2021
1. [test] Move `ava` to `mocha+chai` to test in real browser.
(sindresorhus#105) (sindresorhus#140) (sindresorhus#142)
2. [test] seprate non special-protocol-schemes(sindresorhus#147)
3. [doc] Update readme
@loynoir
Copy link
Author

loynoir commented Aug 9, 2021

Google Chrome 92
chrome

Mozilla Firefox 90
firefox

@loynoir loynoir changed the title AssertionError: expected 'sindre:/www.sorhus.com' to deeply equal 'sindre://sorhus.com' Error result when url using custom protocol in browser Aug 11, 2021
@sindresorhus
Copy link
Owner

You should report this bug to https://github.com/nodejs/node if it's still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants