This commit is contained in:
T 2023-11-14 10:58:52 +00:00 committed by GitHub
commit b6d492d1f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,12 +14,15 @@ type fallback struct {
func OpenDefault(fb fallback, requestPath string) (http.File, error) { func OpenDefault(fb fallback, requestPath string) (http.File, error) {
requestPath = path.Dir(requestPath) requestPath = path.Dir(requestPath)
defaultFile := requestPath + "/" + fb.defaultPath; defaultFile := requestPath + fb.defaultPath;
f, err := fb.fs.Open(defaultFile) f, err := fb.fs.Open(defaultFile)
if os.IsNotExist(err) && requestPath != "" { if os.IsNotExist(err) && requestPath != "" {
parentPath, _ := path.Split(requestPath) parentPath, _ := path.Split(requestPath)
return OpenDefault(fb, parentPath)
if parentPath != requestPath {
return OpenDefault(fb, parentPath)
}
} }
return f, err return f, err
} }