fix infinite recursion in fallback

This commit is contained in:
Tom Shortall 2023-11-14 10:58:09 +00:00
parent 72ed8fa4a9
commit db1c5bab13

View file

@ -14,13 +14,16 @@ 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)
if parentPath != requestPath {
return OpenDefault(fb, parentPath)
}
}
return f, err
}