0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00

browse: return forbidden (403) only when it is a permission error.

This commit is contained in:
Abiola Ibrahim 2015-05-10 17:56:03 +01:00
parent e2273ea676
commit a1312465b5

View file

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