Compare commits

..

2 commits

Author SHA1 Message Date
WJQSERVER
4955fb9d03
Merge pull request #52 from infinite-iroha/dev
fix StaticFS
2025-09-14 08:27:29 +08:00
wjqserver
5b98310de5 fix StaticFS 2025-09-14 08:24:01 +08:00

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))
} }