From c203a5cc2f12d8c1c3e96d4f08bdd2bb2823e997 Mon Sep 17 00:00:00 2001 From: BeanWei Date: Thu, 27 Oct 2022 17:17:38 +0800 Subject: [PATCH] Fix node standalone for windows system (#5207) --- .changeset/metal-boxes-compare.md | 5 +++++ packages/integrations/node/src/http-server.ts | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 .changeset/metal-boxes-compare.md diff --git a/.changeset/metal-boxes-compare.md b/.changeset/metal-boxes-compare.md new file mode 100644 index 000000000000..7e9495a07b31 --- /dev/null +++ b/.changeset/metal-boxes-compare.md @@ -0,0 +1,5 @@ +--- +'@astrojs/node': patch +--- + +fix static server path for windows system diff --git a/packages/integrations/node/src/http-server.ts b/packages/integrations/node/src/http-server.ts index 98cde3728320..dd6d10686263 100644 --- a/packages/integrations/node/src/http-server.ts +++ b/packages/integrations/node/src/http-server.ts @@ -16,10 +16,9 @@ export function createServer( ) { const listener: http.RequestListener = (req, res) => { if (req.url) { - const fileURL = new URL('.' + req.url, client); - - const stream = send(req, fileURLToPath(fileURL), { - dotfiles: 'deny', + const stream = send(req, encodeURI(req.url), { + root: fileURLToPath(client), + dotfiles: "deny" }); let forwardError = false;