diff --git a/routergroup.go b/routergroup.go index a1e6c928..2e7a5b90 100644 --- a/routergroup.go +++ b/routergroup.go @@ -193,13 +193,15 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS file := c.Param("filepath") // Check if file exists and/or if we have permission to access it - if _, err := fs.Open(file); err != nil { + f, err := fs.Open(file) + if err != nil { c.Writer.WriteHeader(http.StatusNotFound) c.handlers = group.engine.noRoute // Reset index c.index = -1 return } + f.Close() fileServer.ServeHTTP(c.Writer, c.Request) }