v1.1.0 doesn't de-dupe "/" in relative URLs
See original GitHub issueIt looks like the /
deduping regex changed after v0.0.1
// v0.0.1
.replace(/[\/]+/g, '/')
// v1.1.0
.replace(/([^:\s])\/+/g, '$1/')
which means that relative URLs now don’t correctly dedupe leading repeat /
.
// v0.0.1
> join("/", "/");
> "/"
// v1.1.0
> join("/", "/");
> "//"
I can work around it in my own code but if this is only intended to support absolute URLs that may be worth calling out.
Alternatively an option (added via the system introduced in #14) to specify if the URL is intended to be relative and use the older regex may be worthwhile. Thoughts? I can send a PR if you’d like.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Absolute vs relative URLs - Stack Overflow
This URL is relative to the current path. What this means is that it will resolve to different paths depending on where you...
Read more >Path — Elixir v1.12.3 - HexDocs
Returns the given path relative to the given from path. In other words, this function tries to strip the from prefix from path...
Read more >Google: Doesn't Matter if You Use Absolute or Relative URLs ...
John Mueller says, for the most part, it doesn't matter whether you use absolute or relative URLs for internal links.
Read more >Git Large File Storage (LFS) - GitLab Documentation
Managing large files such as audio, video and graphics files has always been one of the shortcomings of Git. The general recommendation is...
Read more >[v2] Relative links on MD files doesn't work as expected #2298
Bug Report On v1 it works just fine. When using the relative links it will work only when there is no / at...
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
Also:
and
That’s definitely works wrong… Any plans to fix this? @jfromaniello?
I think that relative protocol should be supported only when it’s passed explicitly.
This
should return
/some
And this
should return
//some
, since we passed in relative protocol explicitly.Library shouldn’t make any assumptions.