From 6b266e8fb791289bf08c1066f1a3297db5f9e6cb Mon Sep 17 00:00:00 2001 From: Benny~ Date: Sat, 7 Mar 2020 12:58:27 +0800 Subject: [PATCH] remove gif support, send not allowed ext file #25 because it's not perfect --- config.json | 7 ++++++- router.go | 6 ++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config.json b/config.json index 35fc329..ec223ba 100644 --- a/config.json +++ b/config.json @@ -4,5 +4,10 @@ "QUALITY": "80", "IMG_PATH": "/path/to/pics", "EXHAUST_PATH": "", - "ALLOWED_TYPES": ["jpg","png","jpeg","bmp","gif"] + "ALLOWED_TYPES": [ + "jpg", + "png", + "jpeg", + "bmp" + ] } diff --git a/router.go b/router.go index dbfe06b..c851d2e 100644 --- a/router.go +++ b/router.go @@ -42,10 +42,8 @@ func Convert(ImgPath string, ExhaustPath string, AllowedTypes []string, QUALITY } } if !allowed { - msg := "File extension not allowed!" - log.Warnf("%s %s", msg, ImgFilename) - c.Send(msg) - c.SendStatus(403) + log.Warnf("File extension not allowed! %s", ImgFilename) + c.SendFile(RawImageAbs) return }