From 264d40e6ca8e749a6f2b5dd88d93260f140eef0a Mon Sep 17 00:00:00 2001 From: MumuTW Date: Thu, 5 Mar 2026 17:03:37 +0000 Subject: [PATCH] fix: use root option in sendFile to avoid dotfile 500 on SPA refresh When served via npx, the absolute path to index.html traverses .npm, triggering Express 5 / send's dotfile guard. Using the root option makes send only check the relative filename for dotfiles. Fixes #48 --- server/src/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/app.ts b/server/src/app.ts index 1faab285..ab6dcfad 100644 --- a/server/src/app.ts +++ b/server/src/app.ts @@ -133,7 +133,7 @@ export async function createApp( if (uiDist) { app.use(express.static(uiDist)); app.get(/.*/, (_req, res) => { - res.sendFile(path.join(uiDist, "index.html")); + res.sendFile("index.html", { root: uiDist }); }); } else { console.warn("[paperclip] UI dist not found; running in API-only mode");