mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-20 22:52:58 -05:00
Check and return the correct error if Stat method fails (see golang issue #12991)
This commit is contained in:
parent
4db54f8ddc
commit
8ecc366582
1 changed files with 2 additions and 2 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue