mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 21:52:01 +08:00
Clean Path on routing to mitigate directory traversal, bump version to 0.4.1
This commit is contained in:
parent
49569b306a
commit
74b0382ab6
@ -22,7 +22,7 @@ var (
|
|||||||
prefetch, proxyMode bool
|
prefetch, proxyMode bool
|
||||||
remoteRaw = "remote-raw"
|
remoteRaw = "remote-raw"
|
||||||
config Config
|
config Config
|
||||||
version = "0.4.0"
|
version = "0.4.1"
|
||||||
releaseUrl = "https://github.com/webp-sh/webp_server_go/releases/latest/download/"
|
releaseUrl = "https://github.com/webp-sh/webp_server_go/releases/latest/download/"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,6 +16,10 @@ import (
|
|||||||
func convert(c *fiber.Ctx) error {
|
func convert(c *fiber.Ctx) error {
|
||||||
//basic vars
|
//basic vars
|
||||||
var reqURI, _ = url.QueryUnescape(c.Path()) // /mypic/123.jpg
|
var reqURI, _ = url.QueryUnescape(c.Path()) // /mypic/123.jpg
|
||||||
|
|
||||||
|
// delete ../ in reqURI to mitigate directory traversal
|
||||||
|
reqURI = path.Clean(reqURI)
|
||||||
|
|
||||||
var rawImageAbs string
|
var rawImageAbs string
|
||||||
if proxyMode {
|
if proxyMode {
|
||||||
rawImageAbs = config.ImgPath + reqURI
|
rawImageAbs = config.ImgPath + reqURI
|
||||||
|
Loading…
x
Reference in New Issue
Block a user