Skip to content

Commit

Permalink
[fix] upgrade polka and sirv. fixes handling of URLs with unicode cha…
Browse files Browse the repository at this point in the history
…racters (#2191)
  • Loading branch information
benmccann authored Aug 13, 2021
1 parent bba5074 commit 7aa44b7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
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.

0 comments on commit 7aa44b7

Please sign in to comment.