diff --git a/config/config.go b/config/config.go index 78da7fc8..20c79d66 100644 --- a/config/config.go +++ b/config/config.go @@ -50,7 +50,7 @@ var ( ProxyMode bool Prefetch bool Config = NewWebPConfig() - Version = "0.11.2" + Version = "0.11.3" WriteLock = cache.New(5*time.Minute, 10*time.Minute) ConvertLock = cache.New(5*time.Minute, 10*time.Minute) RemoteRaw = "./remote-raw" diff --git a/handler/router.go b/handler/router.go index 3328a867..30f7d91f 100644 --- a/handler/router.go +++ b/handler/router.go @@ -22,6 +22,12 @@ func Convert(c *fiber.Ctx) error { // 2. generate rawImagePath, could be local path or remote url(possible with query string) // 3. pass it to encoder, get the result, send it back + // normal http request will start with / + if !strings.HasPrefix(c.Path(), "/") { + _ = c.SendStatus(http.StatusBadRequest) + return nil + } + var ( reqHostname = c.Hostname() reqHost = c.Protocol() + "://" + reqHostname // http://www.example.com:8000