diff options
Diffstat (limited to 'services/release/release.go')
-rw-r--r-- | services/release/release.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/services/release/release.go b/services/release/release.go index ae610b0e3c..187ebeb486 100644 --- a/services/release/release.go +++ b/services/release/release.go @@ -15,6 +15,7 @@ import ( git_model "code.gitea.io/gitea/models/git" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/modules/container" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/notification" @@ -209,7 +210,7 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod return fmt.Errorf("AddReleaseAttachments: %v", err) } - deletedUUIDsMap := make(map[string]bool) + deletedUUIDs := make(container.Set[string]) if len(delAttachmentUUIDs) > 0 { // Check attachments attachments, err := repo_model.GetAttachmentsByUUIDs(ctx, delAttachmentUUIDs) @@ -220,7 +221,7 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod if attach.ReleaseID != rel.ID { return errors.New("delete attachement of release permission denied") } - deletedUUIDsMap[attach.UUID] = true + deletedUUIDs.Add(attach.UUID) } if _, err := repo_model.DeleteAttachments(ctx, attachments, false); err != nil { @@ -245,7 +246,7 @@ func UpdateRelease(doer *user_model.User, gitRepo *git.Repository, rel *repo_mod } for uuid, newName := range editAttachments { - if !deletedUUIDsMap[uuid] { + if !deletedUUIDs.Contains(uuid) { if err = repo_model.UpdateAttachmentByUUID(ctx, &repo_model.Attachment{ UUID: uuid, Name: newName, |