From e91dbdbcddfa95e958c0aeb876b06eeec4fa5a6c Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 10 Oct 2022 08:32:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E5=AE=9A=E5=90=91?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/modelapp/desensitization.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/routers/modelapp/desensitization.go b/routers/modelapp/desensitization.go index 0c73758a4..8cdc744cf 100644 --- a/routers/modelapp/desensitization.go +++ b/routers/modelapp/desensitization.go @@ -17,6 +17,7 @@ import ( var restyClient *resty.Client var tplExploreUpload base.TplName = "model/tuomin/upload" +var uploadUrl string = "/extension/tuomin/upload" var allowedContentType = []string{"image/jpeg", "image/jpg", "image/png"} func ProcessImageUI(ctx *context.Context) { @@ -28,7 +29,7 @@ func ProcessImage(ctx *context.Context) { file, header, err := ctx.GetFile("file") if err != nil { ctx.Flash.Error(ctx.Tr("model_app.get_file_fail")) - ctx.Redirect(setting.AppSubURL + "/" + string(tplExploreUpload)) + ctx.Redirect(setting.AppSubURL + uploadUrl) return } defer file.Close() @@ -37,7 +38,7 @@ func ProcessImage(ctx *context.Context) { if !isInAllowedContentType(contentType) { ctx.Flash.Error(ctx.Tr("model_app.content_type_unsupported")) - ctx.Redirect(setting.AppSubURL + "/" + string(tplExploreUpload)) + ctx.Redirect(setting.AppSubURL + uploadUrl) return } @@ -46,13 +47,13 @@ func ProcessImage(ctx *context.Context) { "file", header.Filename, contentType, file).Post(setting.ModelApp.DesensitizationUrl + "?mode=" + strconv.Itoa(ctx.QueryInt("mode"))) if err != nil { ctx.Flash.Error(ctx.Tr("model_app.process_image_fail")) - ctx.Redirect(setting.AppSubURL + "/" + string(tplExploreUpload)) + ctx.Redirect(setting.AppSubURL + uploadUrl) return } image, _, err := image.Decode(bytes.NewReader(res.Body())) if err != nil { ctx.Flash.Error(ctx.Tr("model_app.process_image_fail")) - ctx.Redirect(setting.AppSubURL + "/" + string(tplExploreUpload)) + ctx.Redirect(setting.AppSubURL + uploadUrl) return }