From db1c5bab1305bc5b8addc9e3af9ea33a636ffd9c Mon Sep 17 00:00:00 2001 From: Tom Shortall Date: Tue, 14 Nov 2023 10:58:09 +0000 Subject: [PATCH] fix infinite recursion in fallback --- fallback.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fallback.go b/fallback.go index 94ec419..98bff26 100644 --- a/fallback.go +++ b/fallback.go @@ -14,12 +14,15 @@ type fallback struct { func OpenDefault(fb fallback, requestPath string) (http.File, error) { requestPath = path.Dir(requestPath) - defaultFile := requestPath + "/" + fb.defaultPath; + defaultFile := requestPath + fb.defaultPath; f, err := fb.fs.Open(defaultFile) if os.IsNotExist(err) && requestPath != "" { parentPath, _ := path.Split(requestPath) - return OpenDefault(fb, parentPath) + + if parentPath != requestPath { + return OpenDefault(fb, parentPath) + } } return f, err }