question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trailing slash is not preserved

See original GitHub issue
var urlJoin = require('url-join');
var joinedUrl = urlJoin('www.example.com', '/test/?hello=true');
console.log(joinedUrl);

Expected output: 'www.example.com/test/?hello=true'

Actual output: 'www.example.com/test?hello=true'

This causes issues for SEO where having 2 different URLs leads to fragmentation in search results.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Arrvicommented, May 9, 2019

This problem still occurs and requires us to do workarounds.

1reaction
ArmorDarkscommented, Feb 26, 2017

I think situation is easier.

'/test/?hello=true' contains / before ?, so it should be preserved as whole fragment. It’s logical, expected behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should You Have a Trailing Slash at the End of URLs? - Ahrefs
A trailing slash is a forward slash (“/”) placed at the end of a URL such as domain.com/ or domain.com/page/. But should you...
Read more >
Trailing slash in links not preserved · Issue #94 - GitHub
If an erroneous server blunders around redirects (eg. nginx) and sends the client off to a bad location, there can even be a...
Read more >
Trailing Slashes and SEO - Best Practice Guide | Safari Digital
Trailing slashes were a method of indicating that the current web destination was a folder rather than a file. It specified that it...
Read more >
RESTful URI trailing slash or no trailing slash - Stack Overflow
The two positions are: The trailing slash indicates a resource and not having does not. The other argument is that the trailing slash...
Read more >
[Python-Dev] pathlib handling of trailing slash (Issue #21039)
> A pathname that contains at least one non-slash character and that ends with one or more trailing slashes shall be resolved as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found