From 261c3a56a20659a11017ba03e627bf4c789c6899 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 29 Dec 2019 00:33:13 +0100 Subject: [PATCH] [Fix] Release attachment should use DownloadURL() not Name (#9529) * Handle if two or more attachments have the same name * previously only the first could be downloaded - now each is downloadable * dos also take care of #6506 (fix was: #6512) * use func DownloadURL() at issue attatchments too --- routers/repo/repo.go | 2 +- templates/repo/issue/view_content/attachments.tmpl | 6 +++--- templates/repo/release/list.tmpl | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 969f96bfb..d44812729 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -426,7 +426,7 @@ func RedirectDownload(ctx *context.Context) { return } if att != nil { - ctx.Redirect(setting.AppSubURL + "/attachments/" + att.UUID) + ctx.Redirect(att.DownloadURL()) return } } diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index e2d7d1b9d..a97f5d85d 100644 --- a/templates/repo/issue/view_content/attachments.tmpl +++ b/templates/repo/issue/view_content/attachments.tmpl @@ -1,9 +1,9 @@ {{range .Attachments}} - + {{if FilenameIsImage .Name}} - + {{else}} {{end}} -{{end}} \ No newline at end of file +{{end}} diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 777d3a2b0..90a45b9b6 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -82,11 +82,11 @@ {{end}} {{if .Attachments}} - {{range $attachment := .Attachments}} + {{range .Attachments}}
  • - - {{$attachment.Name}} - {{$attachment.Size | FileSize}} + + {{.Name}} + {{.Size | FileSize}}
  • {{end}}