Merge 00a07adccf5a93610ab424d00ed739ee716c3a4b into 0f09c3a9b4626d9fe9979cf4d0521d6ae32ab646

This commit is contained in:
water 2026-10-12 08:31:36 -04:00 committed by GitHub
commit b91fa5a142
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -259,6 +259,10 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
}
file := c.Param("filepath")
// Clean the path to handle trailing slashes and invalid paths.
// Many fs.FS implementations (e.g. fs.Sub, http.FS) reject paths with
// trailing slashes because fs.ValidPath considers them invalid.
file = path.Clean(file)
// Check if file exists and/or if we have permission to access it
f, err := fs.Open(file)
if err != nil {