Skip to content

Commit ecc6080

Browse files
committed
[fix] decode path only once to fix loading unicode routes
1 parent c3ca3fb commit ecc6080

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

packages/adapter-node/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"tiny-glob": "^0.2.9"
2626
},
2727
"devDependencies": {
28+
"@polka/url": "^1.0.0-next.15",
2829
"@rollup/plugin-json": "^4.1.0",
2930
"@sveltejs/kit": "workspace:*",
3031
"c8": "^7.7.2",

packages/adapter-node/src/server.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import compression from 'compression';
33
import fs from 'fs';
44
import { dirname, join } from 'path';
55
import polka from 'polka';
6+
import { parse } from '@polka/url';
67
import sirv from 'sirv';
78
import { fileURLToPath } from 'url';
89

@@ -38,7 +39,13 @@ export function createServer({ render }) {
3839
})
3940
: noop_handler;
4041

41-
const server = polka().use(
42+
const server = polka();
43+
// Polka has a non-standard behavior of decoding the request path
44+
// Disable it so that we don't double-decode. SvelteKit will handle decoding
45+
server.parse = (req) => {
46+
return parse(req, false);
47+
};
48+
server.use(
4249
compression({ threshold: 0 }),
4350
assets_handler,
4451
prerendered_handler,

pnpm-lock.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)