From b691468f5501d5a706f1530e47809039c2669d8d Mon Sep 17 00:00:00 2001 From: Kristian Papadakis <98982554+kristian-presso@users.noreply.github.com> Date: Fri, 16 Oct 2026 19:47:25 +0100 Subject: [PATCH] fix(basic-host): serve sandbox.html when the checkout is under a dotted directory `res.sendFile` with an absolute path and no `root` makes `send` check every segment of the path for dotfiles, and it ignores dotfiles by default. So when any directory above examples/basic-host starts with a dot (`.cache/`, `.runs/`, a `.worktrees/` checkout), the sandbox server answers 404 for sandbox.html while the host page, served through `express.static` with a root, loads fine. The View then never renders. Pass the file name with `root: DIRECTORY` so only the relative path is checked, as `express.static` already does for the host page. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DyfRBGJuWRersRLswfqPwd --- examples/basic-host/serve.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/basic-host/serve.ts b/examples/basic-host/serve.ts index bc3fbff14..941a8c846 100644 --- a/examples/basic-host/serve.ts +++ b/examples/basic-host/serve.ts @@ -124,7 +124,9 @@ sandboxApp.get(["/", "/sandbox.html"], (req, res) => { res.setHeader("Pragma", "no-cache"); res.setHeader("Expires", "0"); - res.sendFile(join(DIRECTORY, "sandbox.html")); + // With `root`, only the relative path is checked for dotfiles. An absolute path would 404 + // whenever any directory above DIRECTORY starts with a dot (e.g. `.cache/`). + res.sendFile("sandbox.html", { root: DIRECTORY }); }); sandboxApp.use((_req, res) => {