-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trailingSlash
ignore
gives wrong URL pathname
#9595
Comments
trailingSlash
ignore
gives wrong URL pathname
I am facing similar issue where client side navigation with a trailing slash doesn't contain trailing slash in the pathname in load function. As a workaround, I am just adding a trailing slash if it's not already present. Hoping to see this fixed sooner. |
updateAfter some debugging if found out, that After some debugging, here is some more info:
adding to that:
|
@Rich-Harris the logic was introduced with PR #7719 . For every client site routing the trailing slash logic is never called and it is therefore undefined, when calling |
@dummdidumm as reviewer of this PR, you also might be able to give more insight into the question above. 😊 |
I think we did that because data requests don't need to be redirected, but the logic seems flawed because while we don't want to redirect, we still want to compute the |
fixes #9595 Trailing slash was never set for preloading data through someroute/__data.json
I've updated the stackblitz link to use kit v1.15.9 and this bug still occurs. Do you have any idea? @dummdidumm / @dreitzner :) |
@GingerAdonis that is weird.... when I create a new SvelteKit project and run it locally, I get the correct behavior. |
Your repo has a |
ok, that makes sense, there is currently no way to communicate to the server that there should be a trailing slash in preload, when it is set to ignore. I updated my test repo with Example: |
@dummdidumm Can the issue be re-opened? Thank you. :) |
I'm kind-of stuck on this issue. Is there anyone that knows a (hacky) workaround for this issue? Thanks in advance. |
Describe the bug
Viewing a page with a trailing slash when rendered clientside will give an URL pathname without the trailing slash in
+page.server.js
. This is quite problematic for customtrailingSlash
handling in the load function.Example:
/myroute/
server load gives pathname:/myroute/
(ok)/myroute/
client load gives pathname:/myroute
(not ok)Reproduction
Please note that
trailingSlash
is set toignore
. Click both links and see the problem when viewing a page with a trailing slash.https://stackblitz.com/edit/sveltejs-kit-template-default-y3g4ee?file=src/routes/about/+page.svelte
Logs
No response
System Info
Severity
serious, but I can work around it
Additional Information
No response
The text was updated successfully, but these errors were encountered: