Merge 312cd7c9bddf3280c4aac6b438221289e34a8182 into ef68fa032c0e6ce637db56e89ec734c0de0a9f5e

This commit is contained in:
aleimu 2025-05-15 09:16:57 +02:00 committed by GitHub
commit 751519a9ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -221,19 +221,6 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
if _, noListing := fs.(*OnlyFilesFS); noListing { if _, noListing := fs.(*OnlyFilesFS); noListing {
c.Writer.WriteHeader(http.StatusNotFound) c.Writer.WriteHeader(http.StatusNotFound)
} }
file := c.Param("filepath")
// Check if file exists and/or if we have permission to access it
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) fileServer.ServeHTTP(c.Writer, c.Request)
} }
} }