From a84e934d21b384d8ffdb40787309b98bc69d5f04 Mon Sep 17 00:00:00 2001 From: Shiina <86217807+QingXia-Ela@users.noreply.github.com> Date: Thu, 2 Feb 2023 02:53:09 +0800 Subject: [PATCH] Fix incorrent encoded when path has other language characters (#6088) * fix: Incorrent encoded when path has Chinese * chore: exec changeset --- .changeset/shaggy-gifts-beg.md | 5 +++++ packages/integrations/node/src/http-server.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/shaggy-gifts-beg.md diff --git a/.changeset/shaggy-gifts-beg.md b/.changeset/shaggy-gifts-beg.md new file mode 100644 index 000000000..cda46e047 --- /dev/null +++ b/.changeset/shaggy-gifts-beg.md @@ -0,0 +1,5 @@ +--- +'@astrojs/node': patch +--- + +fix incorrent encoded when path has other language characters diff --git a/packages/integrations/node/src/http-server.ts b/packages/integrations/node/src/http-server.ts index 19e33c84a..8eea3c170 100644 --- a/packages/integrations/node/src/http-server.ts +++ b/packages/integrations/node/src/http-server.ts @@ -19,7 +19,7 @@ export function createServer( if (req.url) { let pathname = removeBase(req.url); pathname = pathname[0] === '/' ? pathname : '/' + pathname; - const stream = send(req, encodeURI(pathname), { + const stream = send(req, encodeURI(decodeURI(pathname)), { root: fileURLToPath(client), dotfiles: pathname.startsWith('/.well-known/') ? 'allow' : 'deny', });