aboutsummaryrefslogtreecommitdiffstats
path: root/modules/upload
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-10-11 00:49:59 +0100
committerGitHub <noreply@github.com>2020-10-11 00:49:59 +0100
commit7eb846013299465e4cd73f76f13a00984183146e (patch)
tree0263f6af28d7b3247545fff3632ba94c9119a58e /modules/upload
parent6f2784911fe739d3b83787b7984c1b8a2fb31690 (diff)
downloadgitea-7eb846013299465e4cd73f76f13a00984183146e.tar.gz
gitea-7eb846013299465e4cd73f76f13a00984183146e.zip
Fix attachments list in edit comment (#13036)
#11141 broke the appearance of dropzone attachments when editting comments causing poorly updating lists. This PR fixes this. Fix #12583 Signed-off-by: Andrew Thornton art27@cantab.net
Diffstat (limited to 'modules/upload')
-rw-r--r--modules/upload/upload.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/upload/upload.go b/modules/upload/upload.go
index e020faca7e..97f0df0542 100644
--- a/modules/upload/upload.go
+++ b/modules/upload/upload.go
@@ -75,18 +75,25 @@ func AddUploadContext(ctx *context.Context, uploadType string) {
if uploadType == "release" {
ctx.Data["UploadUrl"] = ctx.Repo.RepoLink + "/releases/attachments"
ctx.Data["UploadRemoveUrl"] = ctx.Repo.RepoLink + "/releases/attachments/remove"
+ ctx.Data["UploadLinkUrl"] = ctx.Repo.RepoLink + "/releases/attachments"
ctx.Data["UploadAccepts"] = strings.Replace(setting.Repository.Release.AllowedTypes, "|", ",", -1)
ctx.Data["UploadMaxFiles"] = setting.Attachment.MaxFiles
ctx.Data["UploadMaxSize"] = setting.Attachment.MaxSize
} else if uploadType == "comment" {
ctx.Data["UploadUrl"] = ctx.Repo.RepoLink + "/issues/attachments"
ctx.Data["UploadRemoveUrl"] = ctx.Repo.RepoLink + "/issues/attachments/remove"
+ if len(ctx.Params(":index")) > 0 {
+ ctx.Data["UploadLinkUrl"] = ctx.Repo.RepoLink + "/issues/" + ctx.Params(":index") + "/attachments"
+ } else {
+ ctx.Data["UploadLinkUrl"] = ctx.Repo.RepoLink + "/issues/attachments"
+ }
ctx.Data["UploadAccepts"] = strings.Replace(setting.Attachment.AllowedTypes, "|", ",", -1)
ctx.Data["UploadMaxFiles"] = setting.Attachment.MaxFiles
ctx.Data["UploadMaxSize"] = setting.Attachment.MaxSize
} else if uploadType == "repo" {
ctx.Data["UploadUrl"] = ctx.Repo.RepoLink + "/upload-file"
ctx.Data["UploadRemoveUrl"] = ctx.Repo.RepoLink + "/upload-remove"
+ ctx.Data["UploadLinkUrl"] = ctx.Repo.RepoLink + "/upload-file"
ctx.Data["UploadAccepts"] = strings.Replace(setting.Repository.Upload.AllowedTypes, "|", ",", -1)
ctx.Data["UploadMaxFiles"] = setting.Repository.Upload.MaxFiles
ctx.Data["UploadMaxSize"] = setting.Repository.Upload.FileMaxSize