Describe the bug
Routing result is Not Found if the route is encoded URI during dev server.
eg: With route src/routes/%E5%88%9D%E3%82%81/+page.svelte when navigating to http://localhost:5173/%E5%88%9D%E3%82%81
Not found: /src/routes/%E5%88%9D%E3%82%81/+page.svelte
Error: Not found: /src/routes/%E5%88%9D%E3%82%81/+page.svelte
However, preview works as expected. After pnpm build && pnpm preview, the route http://localhost:4173/%E5%88%9D%E3%82%81 is accessible.
For the reference:
encodeURI('初め') => '%E5%88%9D%E3%82%81'
Reproduction
https://github.com/kwchang0831/issue-sveltekit-already-encoded-route
To Reproduce:
- Create a route with encoded URI. eg:
src/routes/%E5%88%9D%E3%82%81/+page.svelte.
- Set
export const prerender = true; in +layout.ts.
- Run
pnpm dev.
- In browser, navigate to the route
http://localhost:5173/%E5%88%9D%E3%82%81.
Logs
No response
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (12) x64 Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz
Memory: 22.60 GB / 31.35 GB
Container: Yes
Shell: 3.5.1 - /usr/bin/fish
Binaries:
Node: 18.7.0 - ~/.asdf/installs/nodejs/18.7.0/bin/node
Yarn: 1.22.19 - ~/.asdf/shims/yarn
npm: 8.15.0 - ~/.asdf/plugins/nodejs/shims/npm
Browsers:
Firefox: 105.0.1
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.80
@sveltejs/kit: next => 1.0.0-next.505
svelte: ^3.44.0 => 3.50.1
vite: ^3.1.0 => 3.1.4
Severity
serious, but I can work around it
Additional Information
If the route name is %E5%88 which is not a valid encoded URI, just a arbitrary string, it will result in URIError: URI malformed when access the route.
So, it seems like when handing route name, it assumes that the name is previously encoded or just to make sure the name is not encoded.
Describe the bug
Routing result is Not Found if the route is encoded URI during dev server.
eg: With route
src/routes/%E5%88%9D%E3%82%81/+page.sveltewhen navigating tohttp://localhost:5173/%E5%88%9D%E3%82%81However, preview works as expected. After
pnpm build && pnpm preview, the routehttp://localhost:4173/%E5%88%9D%E3%82%81is accessible.For the reference:
Reproduction
https://github.com/kwchang0831/issue-sveltekit-already-encoded-route
To Reproduce:
src/routes/%E5%88%9D%E3%82%81/+page.svelte.export const prerender = true;in+layout.ts.pnpm dev.http://localhost:5173/%E5%88%9D%E3%82%81.Logs
No response
System Info
System: OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish) CPU: (12) x64 Intel(R) Xeon(R) CPU D-1541 @ 2.10GHz Memory: 22.60 GB / 31.35 GB Container: Yes Shell: 3.5.1 - /usr/bin/fish Binaries: Node: 18.7.0 - ~/.asdf/installs/nodejs/18.7.0/bin/node Yarn: 1.22.19 - ~/.asdf/shims/yarn npm: 8.15.0 - ~/.asdf/plugins/nodejs/shims/npm Browsers: Firefox: 105.0.1 npmPackages: @sveltejs/adapter-auto: next => 1.0.0-next.80 @sveltejs/kit: next => 1.0.0-next.505 svelte: ^3.44.0 => 3.50.1 vite: ^3.1.0 => 3.1.4Severity
serious, but I can work around it
Additional Information
If the route name is
%E5%88which is not a valid encoded URI, just a arbitrary string, it will result inURIError: URI malformedwhen access the route.So, it seems like when handing route name, it assumes that the name is previously encoded or just to make sure the name is not encoded.