fix infinite recursion in fallback
This commit is contained in:
parent
72ed8fa4a9
commit
db1c5bab13
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue