sindresorhus / normalize-url

Normalize a URL
MIT License
837 stars 123 forks source link

Exactly 2 forward slashes between the host+port & path is not normalizing to 1 forward slash #76

Closed RyanBard closed 5 years ago

RyanBard commented 5 years ago

You can see it by adding the following test cases:

t.is(normalizeUrl('http://sindresorhus.com:5000///foo'), 'http://sindresorhus.com:5000/foo'); // passes
t.is(normalizeUrl('http://sindresorhus.com///foo'), 'http://sindresorhus.com/foo'); // passes
t.is(normalizeUrl('http://sindresorhus.com:5000//foo'), 'http://sindresorhus.com:5000/foo'); // fails - http://sindresorhus.com:5000//foo
t.is(normalizeUrl('http://sindresorhus.com//foo'), 'http://sindresorhus.com/foo'); // fails - http://sindresorhus.com//foo
joual commented 5 years ago

Hey @RyanBard, I stumbled onto the same issue you did. I pushed a fix at #78. Let me add your tests just to verify it fixes your issues as well.

joual commented 5 years ago

Yep, added your tests and everything seems to pass.