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

Incorrect URL returned when protocol is missing #187

Closed
dawidmohr opened this issue Jan 4, 2024 · 0 comments
Closed

Incorrect URL returned when protocol is missing #187

dawidmohr opened this issue Jan 4, 2024 · 0 comments

Comments

@dawidmohr
Copy link

I wanted to use normalize-url in my project, but I noticed a problem

In the documentation, one of the examples does not work (the one I need :))

normalizeUrl('sindresorhus.com:123', {
	removeExplicitPort: true
});
//=> 'http://sindresorhus.com'
t.is(normalizeUrl('sindresorhus.com:123', options), 'http://sindresorhus.com');

The test returned:
'sindresorhus.com:123'
so there is an issue

I looked at the code and noticed that the hasCustomProtocol function returns the wrong value

So I prepared a quick fix, but I'm not a URL specialist, my PR is rather illustrative, so feel free to close it
#186

My thought was that there are no dots in the protocol, and there is always a dot between the domain name and the TLD, so did this

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

1 participant