From 8906942e9cb48906a67e4b17919accf51c18edc5 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Tue, 16 Apr 2024 00:01:52 +0200 Subject: fix possible redirect loop --- src/app.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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, -- cgit 1.4.1