Skip to content

Commit 93bbdc8

Browse files
committed
fix: return 404 if PWAHandler cannot find files
This is better than crashing through a C++ assertion.
1 parent 5a5c4b5 commit 93bbdc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: packages/server/PWAHandler.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import acceptsBrotli from './acceptsBrotli'
33
import serveStatic from './utils/serveStatic'
44

55
const PWAHandler = (res: HttpResponse, req: HttpRequest) => {
6-
serveStatic(res, req.getUrl().slice(1), acceptsBrotli(req))
6+
if (!serveStatic(res, req.getUrl().slice(1), acceptsBrotli(req))) {
7+
res.writeStatus('404').end()
8+
}
79
}
810
export default PWAHandler

0 commit comments

Comments
 (0)