Skip to content

Client-side navigation does not perform trailing slash redirect #8842

Closed
@eltigerchino

Description

Describe the bug

After building, client-side navigating to an incorrect URL, such as /test/, does not redirect to its counterpart /test.

The issue occurs when the preload data attribute is present on the link.

Reproduction

https://stackblitz.com/edit/github-vabxnk?file=src%2Froutes%2Ftest%2F%2Bpage.svelte,src%2Froutes%2F%2Blayout.svelte,src%2Froutes%2F%2Bpage.svelte

  1. Run pnpm build && pnpm preview.
  2. Click on the link to the page /test/

Expected

Redirect from /test/ to /test.

Actual

Client loads /test page content and does not redirect. Browser URL remains as /test/.

Logs

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.2 => 1.0.2 
    @sveltejs/kit: ^1.3.8 => 1.3.8 
    svelte: ^3.55.1 => 3.55.1 
    vite: ^4.0.4 => 4.0.4

Severity

serious, but I can work around it

Additional Information

No response

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready to implementplease submit PRs for these issues!

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions