mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
fix panic due to direct request on /
This commit is contained in:
parent
c0eabe3bc1
commit
4213dff391
@ -74,7 +74,14 @@ func main() {
|
|||||||
IMG_PATH := c.Path()
|
IMG_PATH := c.Path()
|
||||||
|
|
||||||
// jpg
|
// jpg
|
||||||
IMG_EXT := strings.Split(path.Ext(IMG_PATH), ".")[1]
|
seps := strings.Split(path.Ext(IMG_PATH), ".")
|
||||||
|
var IMG_EXT string
|
||||||
|
if len(seps) >= 2 {
|
||||||
|
IMG_EXT = seps[1]
|
||||||
|
} else {
|
||||||
|
c.Send("Invalid request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// tsuki.jpg
|
// tsuki.jpg
|
||||||
IMG_NAME := path.Base(IMG_PATH)
|
IMG_NAME := path.Base(IMG_PATH)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user