diff options
author | Alan Pearce | 2024-04-16 00:33:13 +0200 |
---|---|---|
committer | Alan Pearce | 2024-04-16 00:33:13 +0200 |
commit | f97814c2cdc8d34d5816afe7ed81c841ead84998 (patch) | |
tree | f61eccce87c6bbbcbae7e0298e0ec0d335d7668a | |
parent | 5fa3e47c00e5d584033c325f2ccdd3c917aa33a1 (diff) | |
download | website-f97814c2cdc8d34d5816afe7ed81c841ead84998.tar.lz website-f97814c2cdc8d34d5816afe7ed81c841ead84998.tar.zst website-f97814c2cdc8d34d5816afe7ed81c841ead84998.zip |
disallow fetching pre-compressed files directly
-rw-r--r-- | src/app.ts | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/app.ts b/src/app.ts index e6f82a3..6e714f9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -160,10 +160,12 @@ export const server = { }, }); } + const { base, ext } = path.parse(pathname); const file = files.get(pathname); let contentEncoding = "identity"; let suffix = ""; if ( + ![".br", ".zst", ".gz"].includes(ext || base) && !pathname.startsWith("/404.html") && file && (await file.handle.exists()) |