Commit a1312465 authored by Abiola Ibrahim's avatar Abiola Ibrahim

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

parent e2273ea6
...@@ -99,8 +99,11 @@ func (b Browse) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) { ...@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment