0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-01-13 22:51:08 -05:00

Merge pull request #71 from abiosoft/master

browse: return forbidden (403) only when it is a permission error.
This commit is contained in:
Abiola Ibrahim 2015-05-10 17:59:55 +01:00
commit 018fd21741

View file

@ -99,8 +99,11 @@ func (b Browse) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
// Load directory contents // Load directory contents
file, err := os.Open(b.Root + r.URL.Path) file, err := os.Open(b.Root + r.URL.Path)
if err != nil { if err != nil {
if os.IsPermission(err) {
return http.StatusForbidden, err return http.StatusForbidden, err
} }
return http.StatusNotFound, err
}
defer file.Close() defer file.Close()
files, err := file.Readdir(-1) files, err := file.Readdir(-1)