From 999c8d8b8efe1d396ddc40c83b888529e145d967 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 28 Dec 2019 19:12:01 +0100 Subject: [PATCH 1/4] handle if two or more attachement have same name * before only first got downloaded - now each is downloadable * dos also take care of #6506 (fix was: #6512) --- templates/repo/release/list.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 777d3a2b050cf..37baa89a7ff93 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -84,7 +84,7 @@ {{if .Attachments}} {{range $attachment := .Attachments}}
  • - + {{$attachment.Name}} {{$attachment.Size | FileSize}} From c11bfa330c485efdd416cc0b98c00075274ec2f0 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 28 Dec 2019 19:21:47 +0100 Subject: [PATCH 2/4] use func DownloadURL() at issue attatchments too --- templates/repo/issue/view_content/attachments.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/issue/view_content/attachments.tmpl b/templates/repo/issue/view_content/attachments.tmpl index e2d7d1b9de679..a97f5d85da429 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}} From 7f62ec47b956a345f04705cd1f8cf4a1a46e2bf8 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 28 Dec 2019 19:30:14 +0100 Subject: [PATCH 3/4] refactor template --- templates/repo/release/list.tmpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index 37baa89a7ff93..90a45b9b67620 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}} From 0fc730066478fe46ccdfabf9faec308d060a2d98 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 28 Dec 2019 20:09:46 +0100 Subject: [PATCH 4/4] feed the CI --- routers/repo/repo.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/repo.go b/routers/repo/repo.go index 969f96bfba351..d44812729fe4e 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 } }