Fix incorrent encoded when path has other language characters (#6088)

* fix: Incorrent encoded when path has Chinese

* chore: exec changeset
This commit is contained in:
Shiina 2023-02-02 02:53:09 +08:00 committed by Matthew Phillips
parent e88ea2c7cf
commit a84e934d21
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/node': patch
---
fix incorrent encoded when path has other language characters

View file

@ -19,7 +19,7 @@ export function createServer(
if (req.url) { if (req.url) {
let pathname = removeBase(req.url); let pathname = removeBase(req.url);
pathname = pathname[0] === '/' ? pathname : '/' + pathname; pathname = pathname[0] === '/' ? pathname : '/' + pathname;
const stream = send(req, encodeURI(pathname), { const stream = send(req, encodeURI(decodeURI(pathname)), {
root: fileURLToPath(client), root: fileURLToPath(client),
dotfiles: pathname.startsWith('/.well-known/') ? 'allow' : 'deny', dotfiles: pathname.startsWith('/.well-known/') ? 'allow' : 'deny',
}); });