diff options
-rw-r--r-- | src/app.ts | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/app.ts b/src/app.ts index 57ae71d..e03f50e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -165,30 +165,24 @@ export const server = { const encodings = (request.headers.get("accept-encoding") || "") .split(",") .map((x) => x.trim().toLowerCase()); - if (encodings.includes("br") && files.has(file.relPath + ".br")) { + if (encodings.includes("br") && files.has(pathname + ".br")) { transaction.setHttpStatus(200); transaction.setTag("http.content-encoding", "br"); - return serveFile(files.get(file.relPath + ".br"), 200, { + return serveFile(files.get(pathname + ".br"), 200, { "content-encoding": "br", "content-type": file.type, }); - } else if ( - encodings.includes("zstd") && - files.has(file.relPath + ".zst") - ) { + } else if (encodings.includes("zstd") && files.has(pathname + ".zst")) { transaction.setHttpStatus(200); transaction.setTag("http.content-encoding", "zstd"); - return serveFile(files.get(file.relPath + ".zst"), 200, { + return serveFile(files.get(pathname + ".zst"), 200, { "content-encoding": "zstd", "content-type": file.type, }); - } else if ( - encodings.includes("gzip") && - files.has(file.relPath + ".gz") - ) { + } else if (encodings.includes("gzip") && files.has(pathname + ".gz")) { transaction.setHttpStatus(200); transaction.setTag("http.content-encoding", "gzip"); - return serveFile(files.get(file.relPath + ".gz"), 200, { + return serveFile(files.get(pathname + ".gz"), 200, { "content-encoding": "gzip", "content-type": file.type, }); |