Duplicate slashes "//" in urls when a part is empty
See original GitHub issueurl-join version 3.0.0
> urlJoin('path/', '', '/test')
'path/test' # expected
'path//test' # actual
> urlJoin('path', '', /test')
'path/test' # expected
'path//test' # actual
> urlJoin('path', null, /test')
'path/test' # expected
'path//test' # actual
In more detail, I’ve got an array of bits of a url. Sometimes, parts are optional, so I set them to ‘’ and assume the url joiner will throw away the empty bits
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
url with multiple forward slashes, does it break anything?
I have a script that parses URLs and i was wondering if it would break anything (or change the path) if i replaced...
Read more >What does a double slash in the URL path mean?
This will issue a HTTP 301 Moved Permanently redirect so that any double slashes are stripped out of the URL.
Read more >Why is there no error when I enter many slashes in a file URL ...
RFC3986, section 3.3 says multiple slashes are valid in URLs. The / in a URL determines where segments of the URL are split....
Read more >Trailing Slashes on URLs: Contentious or Settled? | CSS-Tricks
If you render the same content, both with and without a trailing slash, that's theoretically a duplicate content penalty and a no-no.
Read more >Should You Have a Trailing Slash at the End of URLs? - Ahrefs
These URLs are treated exactly the same and it doesn't matter which version you use. Trailing slashes matter for other URLs. domain.com/page ≠ ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ooh, I didn’t even think of that use case. I’ll try to keep that in mind in the future too. For reference, here’s Node’s
path.join
with some variations of that case:Thanks for reporting this. I just published v4 addressing this the same way that
path.join
does.