Merge pull request #52 from infinite-iroha/dev

fix StaticFS
This commit is contained in:
WJQSERVER 2025-09-14 08:27:29 +08:00 committed by GitHub
commit 4955fb9d03
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -244,7 +244,7 @@ func (engine *Engine) StaticFS(relativePath string, fs http.FileSystem) {
relativePath += "/" relativePath += "/"
} }
fileServer := http.FileServer(fs) fileServer := http.StripPrefix(relativePath, http.FileServer(fs))
engine.ANY(relativePath+"*filepath", GetStaticFSHandleFunc(fileServer)) engine.ANY(relativePath+"*filepath", GetStaticFSHandleFunc(fileServer))
} }
@ -258,7 +258,7 @@ func (group *RouterGroup) StaticFS(relativePath string, fs http.FileSystem) {
relativePath += "/" relativePath += "/"
} }
fileServer := http.FileServer(fs) fileServer := http.StripPrefix(relativePath, http.FileServer(fs))
group.ANY(relativePath+"*filepath", GetStaticFSHandleFunc(fileServer)) group.ANY(relativePath+"*filepath", GetStaticFSHandleFunc(fileServer))
} }