From bb8483ebbb13c9f93b9aef65749183e2acbf9cca Mon Sep 17 00:00:00 2001 From: YuleiLan Date: Thu, 17 Sep 2020 14:58:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/public/file.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apis/public/file.go b/apis/public/file.go index f9c8215..27ad51b 100644 --- a/apis/public/file.go +++ b/apis/public/file.go @@ -37,6 +37,11 @@ func UploadFile(c *gin.Context) { tag, _ = c.GetPostForm("type") fileType = c.DefaultQuery("file_type", "images") + if fileType != "images" && fileType != "files" { + app.Error(c, -1, fmt.Errorf("上传接口目前,仅支持图片上传和文件上传"), "") + return + } + if viper.GetBool("settings.domain.getHost") { urlPrefix = fmt.Sprintf("http://%s/", c.Request.Host) } else {