From f97814c2cdc8d34d5816afe7ed81c841ead84998 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Apr 2024 00:33:13 +0200 Subject: disallow fetching pre-compressed files directly --- src/app.ts | 2 ++ 1 file changed, 2 insertions(+) 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()) -- cgit 1.4.1