Commit 8ecc3665 authored by Makpoc's avatar Makpoc

Check and return the correct error if Stat method fails (see golang issue #12991)

parent 4db54f8d
...@@ -62,8 +62,8 @@ func (fh *fileHandler) serveFile(w http.ResponseWriter, r *http.Request, name st ...@@ -62,8 +62,8 @@ func (fh *fileHandler) serveFile(w http.ResponseWriter, r *http.Request, name st
} }
defer f.Close() defer f.Close()
d, err1 := f.Stat() d, err := f.Stat()
if err1 != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
return http.StatusNotFound, nil return http.StatusNotFound, nil
} else if os.IsPermission(err) { } else if os.IsPermission(err) {
......
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