From 3c59d31bc605bbefc6636e9b0a93e90ad2696ed9 Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Fri, 9 Dec 2022 07:35:56 +0100 Subject: Add API management for issue/pull and comment attachments (#21783) Close #14601 Fix #3690 Revive of #14601. Updated to current code, cleanup and added more read/write checks. Signed-off-by: Andrew Thornton Signed-off-by: Andre Bruch Co-authored-by: zeripath Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Norwin Co-authored-by: Lunny Xiao --- models/migrations/v1_10/v96.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'models/migrations/v1_10') diff --git a/models/migrations/v1_10/v96.go b/models/migrations/v1_10/v96.go index 2abd260be4..422defe838 100644 --- a/models/migrations/v1_10/v96.go +++ b/models/migrations/v1_10/v96.go @@ -30,19 +30,19 @@ func DeleteOrphanedAttachments(x *xorm.Engine) error { } for { - attachements := make([]Attachment, 0, limit) + attachments := make([]Attachment, 0, limit) if err := sess.Where("`issue_id` = 0 and (`release_id` = 0 or `release_id` not in (select `id` from `release`))"). Cols("id, uuid").Limit(limit). Asc("id"). - Find(&attachements); err != nil { + Find(&attachments); err != nil { return err } - if len(attachements) == 0 { + if len(attachments) == 0 { return nil } ids := make([]int64, 0, limit) - for _, attachment := range attachements { + for _, attachment := range attachments { ids = append(ids, attachment.ID) } if len(ids) > 0 { @@ -51,13 +51,13 @@ func DeleteOrphanedAttachments(x *xorm.Engine) error { } } - for _, attachment := range attachements { + for _, attachment := range attachments { uuid := attachment.UUID if err := util.RemoveAll(filepath.Join(setting.Attachment.Path, uuid[0:1], uuid[1:2], uuid)); err != nil { return err } } - if len(attachements) < limit { + if len(attachments) < limit { return nil } } -- cgit v1.2.3