kit
kit copied to clipboard
Client router doesn't strip trailing slashes before redirecting
Describe the bug
When navigating via link to a route that redirects, the client router doesn't
strip the trailing slash, causing the relative redirect to be based in the wrong
directory and the path to be foo/foo/bar instead of foo/bar.
If the link is opened in a new tab instead, everything works as expected.
Reproduction
https://github.com/zqianem/sveltekit-router-trailing-slash-bug
Logs
No response
System Info
System:
OS: Linux 6.3 Arch Linux
CPU: (4) x64 Intel(R) Core(TM) i7-7600U CPU @ 2.80GHz
Memory: 27.30 GB / 31.10 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 16.20.0 - /usr/bin/node
Yarn: 1.22.19 - /usr/bin/yarn
npm: 8.19.2 - /usr/bin/npm
Watchman: 20230222.123454.0 - /usr/bin/watchman
Browsers:
Chromium: 113.0.5672.63
Firefox: 112.0.2
Severity
annoyance
Additional Information
Relevant docs: https://learn.svelte.dev/tutorial/trailingslash
Confirmed that this is still a bug in SvelteKit v2 — updated the dependencies in the reproduction above. Might take another crack at the PR sometime this year 🙂.