From 8ecc36658255366d3c18693841c38ab68822bea3 Mon Sep 17 00:00:00 2001 From: Makpoc Date: Wed, 21 Oct 2015 01:25:38 +0300 Subject: [PATCH] Check and return the correct error if Stat method fails (see golang issue #12991) --- middleware/fileserver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middleware/fileserver.go b/middleware/fileserver.go index d8c59b2e..80cf6f84 100644 --- a/middleware/fileserver.go +++ b/middleware/fileserver.go @@ -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) {