mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 05:32:02 +08:00
Copy ImgName
before invoke c.SendFile since stripTrailingSlashes
in fasthttp will change the content of ctx.URI().Path(), which was once obtained as ImgPath := c.Path()
Signed-off-by: Cocoa <0xbbc@0xbbc.com>
This commit is contained in:
parent
735b7d2cda
commit
25d46611f1
@ -169,11 +169,13 @@ func main() {
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
ImgNameCopy := string([]byte(ImgName))
|
||||
c.SendFile(WebpAbsolutePath)
|
||||
|
||||
// /home/webp_server/exhaust/path/to/tsuki.jpg.1582558100.webp <- older ones will be removed
|
||||
// /home/webp_server/exhaust/path/to/tsuki.jpg.1582558990.webp <- keep the latest one
|
||||
WebpCachedImgPath := path.Clean(fmt.Sprintf("%s/exhaust%s/%s.*.webp", CurrentPath, DirPath, ImgName))
|
||||
WebpCachedImgPath := path.Clean(fmt.Sprintf("%s/exhaust%s/%s.*.webp", CurrentPath, DirPath, ImgNameCopy))
|
||||
matches, err := filepath.Glob(WebpCachedImgPath)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
|
Loading…
x
Reference in New Issue
Block a user