about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-16 00:01:52 +0200
committerAlan Pearce2024-04-16 00:01:52 +0200
commit8906942e9cb48906a67e4b17919accf51c18edc5 (patch)
tree9941d3c1cead0c4f0f3636d56b942e28597e3129
parent3c5f2727364bcfc75fd39e4478a0cfe850a1de9f (diff)
downloadwebsite-8906942e9cb48906a67e4b17919accf51c18edc5.tar.lz
website-8906942e9cb48906a67e4b17919accf51c18edc5.tar.zst
website-8906942e9cb48906a67e4b17919accf51c18edc5.zip
fix possible redirect loop
-rw-r--r--src/app.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/app.ts b/src/app.ts
index 7d5e448..da339c0 100644
--- a/src/app.ts
+++ b/src/app.ts
@@ -217,7 +217,10 @@ export const server = {
             status: status,
             headers: { location: newpath },
           });
-        } else if (files.has(pathname.replace(/index.html$/, ""))) {
+        } else if (
+          pathname.endsWith("index.html") &&
+          files.has(pathname.replace(/index.html$/, ""))
+        ) {
           newpath = pathname.replace(/index.html$/, "");
           metrics.requests.inc({
             content_encoding: contentEncoding,