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 }