0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2025-01-06 22:40:31 -05:00

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

This commit is contained in:
Makpoc 2015-10-21 01:25:38 +03:00
parent 4db54f8ddc
commit 8ecc366582

View file

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