From 70eac24667300c7dd0e1b4aba03a89854f493c76 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 28 Oct 2021 16:18:50 +0800 Subject: [PATCH] show pic --- routers/repo/attachment.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/routers/repo/attachment.go b/routers/repo/attachment.go index 59f297a49..bb48c640b 100755 --- a/routers/repo/attachment.go +++ b/routers/repo/attachment.go @@ -278,7 +278,21 @@ func GetAttachment(ctx *context.Context) { ctx.ServerError("Update", err) return } - http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) + if dataSet != nil { + http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) + } else { + fr, err := storage.Attachments.Open(attach.RelativePath()) + if err != nil { + ctx.ServerError("Open", err) + return + } + defer fr.Close() + if err = ServeData(ctx, attach.Name, fr); err != nil { + ctx.ServerError("ServeData", err) + return + } + } + } else { fr, err := storage.Attachments.Open(attach.RelativePath()) if err != nil {