Skip to content

URI Encoding inconsistent between SSR and Browser routers #4629

Closed
@Bluebie

Description

@Bluebie

Describe the bug

A reasonable user would expect the SvelteKit router to behave the same way in the ssr and browser contexts, regarding uri encoding in route params. This currently isn't the case.

Sample below demonstrates main issue, but also note this inconsistency appears in load functions too, depending if they are run in ssr or browser side

Reproduction

git clone https://github.com/Bluebie/sveltekit-url-params-encoding-issue.git
cd sveltekit-url-params-encoding-issue
npm i
npm run dev

Open browser to http://localhost:3000/test/foo and click the demo links in the list on the bottom of the page to see some examples of how decoding is inconsistent.

Logs

No response

System Info

System:
    OS: macOS 12.3.1
    CPU: (8) arm64 Apple M1
    Memory: 80.17 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 17.8.0 - /opt/homebrew/bin/node
    npm: 8.5.5 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 100.0.4896.88
    Edge: 100.0.1185.39
    Firefox: 97.0.1
    Safari: 15.4
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.34 
    @sveltejs/kit: next => 1.0.0-next.312 
    svelte: ^3.46.0 => 3.47.0

Severity

serious, but I can work around it

Additional Information

Example output of src/routes/test/[param].svelte when navigating to http://localhost:3000/test/why%3Ais%3Acolon

Screen Shot 2022-04-15 at 5 51 31 pm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp1-importantSvelteKit cannot be used by a large number of people, basic functionality is missing, etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions