Browse Source

Merge pull request 'issue点击图片查看,非下载' (#623) from show-issue-pic into V20211101

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/623
Reviewed-by: ychao_1983 <ychao_1983@sina.com>
tags/v1.21.12.1
ychao_1983 4 years ago
parent
commit
c7729ab87d
1 changed files with 15 additions and 1 deletions
  1. +15
    -1
      routers/repo/attachment.go

+ 15
- 1
routers/repo/attachment.go View File

@@ -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 {


Loading…
Cancel
Save