Skip to content
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

[fix] upgrade polka and sirv. fixes handling of URLs with unicode characters #2191

Merged
merged 4 commits into from
Aug 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tame-lions-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/adapter-node': patch
---

[fix] upgrade polka and sirv. fixes handling of URLs with unicode characters
5 changes: 2 additions & 3 deletions packages/adapter-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@
"tiny-glob": "^0.2.9"
},
"devDependencies": {
"@polka/url": "^1.0.0-next.15",
"@rollup/plugin-json": "^4.1.0",
"@sveltejs/kit": "workspace:*",
"c8": "^7.7.2",
"compression": "^1.7.4",
"node-fetch": "^3.0.0-beta.9",
"polka": "^1.0.0-next.15",
"polka": "^1.0.0-next.16",
"rollup": "^2.55.0",
"sirv": "^1.0.12",
"sirv": "^1.0.13",
"uvu": "^0.5.1"
}
}
10 changes: 1 addition & 9 deletions packages/adapter-node/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import compression from 'compression';
import fs from 'fs';
import { dirname, join } from 'path';
import polka from 'polka';
import { parse } from '@polka/url';
import sirv from 'sirv';
import { fileURLToPath } from 'url';

Expand Down Expand Up @@ -39,14 +38,7 @@ export function createServer({ render }) {
})
: noop_handler;

const server = polka();
// Polka has a non-standard behavior of decoding the request path
// Disable it so that adapter-node works just like the rest
// SvelteKit will handle decoding URI components into req.params
server.parse = (req) => {
return parse(req, false);
};
server.use(
const server = polka().use(
compression({ threshold: 0 }),
assets_handler,
prerendered_handler,
Expand Down
23 changes: 15 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.