- } else if fi, err := f.Stat(); err == nil && fi.IsDir() && r.Method == "GET" {
-
- h.serveDirectory(w, r, fi.Name(), fs, r.URL.Path, false)
+ }
+ defer f.Close()
+ if fi, err := f.Stat(); err == nil && fi.IsDir() && r.Method == "GET" {
+ if !strings.HasSuffix(r.URL.Path, "/") {
+ h.seeOtherWithCookie(w, r, r.URL.Path+"/", credentialsOK)
+ } else {
+ h.serveDirectory(w, r, fi.Name(), fs, r.URL.Path, false)
+ }