Skip to content

Commit

Permalink
chore: dont crash for non-existent asset requests
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Jul 20, 2024
1 parent 15e7e4a commit 001938f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/diagnostic/server/bun/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ export function handleBunFetch(config, state, req, server) {

// serve test assets
debug(`Serving asset ${route} for browser ${bId} window ${wId}`);
return new Response(Bun.file(path.join(process.cwd(), config.assets, route)));
const asset = Bun.file(path.join(process.cwd(), config.assets, route));

return asset.exists().then((exists) => {
if (!exists) {
return new Response('Not Found', { status: 404 });
}
new Response(asset);
});
}
}

0 comments on commit 001938f

Please sign in to comment.