mirror of
https://codeberg.org/valpackett/tiddlypwa.git
synced 2026-03-15 04:10:25 -07:00
Server: return 404 when db file has not been added yet
This commit is contained in:
parent
36346ad1d2
commit
524e4b5915
1 changed files with 4 additions and 4 deletions
|
|
@ -274,6 +274,9 @@ function handleDbFile(pattern: URLPattern, req: Request, query: any, ctype: stri
|
|||
return preflightResp('GET, HEAD, OPTIONS');
|
||||
}
|
||||
let [body, etag] = res[0];
|
||||
if (!body) {
|
||||
return Response.json({}, { status: 404 });
|
||||
}
|
||||
const [supportsBrotli, etagstr] = processEtag(etag, req.headers);
|
||||
// if we decomress and Deno recompresses to something else (gzip) it'll mark the ETag as a weak validator
|
||||
const headers = new Headers({
|
||||
|
|
@ -283,10 +286,7 @@ function handleDbFile(pattern: URLPattern, req: Request, query: any, ctype: stri
|
|||
'etag': etagstr,
|
||||
});
|
||||
if (req.headers.get('if-none-match') === etagstr) {
|
||||
return new Response(null, {
|
||||
status: 304,
|
||||
headers,
|
||||
});
|
||||
return new Response(null, { status: 304, headers });
|
||||
}
|
||||
if (supportsBrotli) {
|
||||
headers.set('content-encoding', 'br');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue