Skip to content

Commit 234e929

Browse files
committed
explicitly handle http 404 in cache build script
1 parent 72b8207 commit 234e929

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

buildCache.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import puppeteer from "puppeteer";
33
const server = Bun.serve({
44
async fetch (req) {
55
const path = new URL(req.url).pathname.replace("/convert/", "") || "index.html";
6-
return new Response(Bun.file(`${__dirname}/dist/${path}`));
6+
const file = Bun.file(`${__dirname}/dist/${path}`);
7+
if (!(await file.exists())) return new Response("Not Found", { status: 404 });
8+
return new Response(file);
79
},
810
port: 8080
911
});

0 commit comments

Comments
 (0)