diff options
author | Antoine GIRARD <sapk@users.noreply.github.com> | 2019-12-11 01:01:52 +0100 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-12-11 00:01:52 +0000 |
commit | c3d31e55346329a221cc0ae37d89d1fba11ea737 (patch) | |
tree | 61914ec27d02be2351a1951ada1526e9beb455db /models/release.go | |
parent | 50da9f7daed4fe3e8f0c76f23eeb987e97de4962 (diff) | |
download | gitea-c3d31e55346329a221cc0ae37d89d1fba11ea737.tar.gz gitea-c3d31e55346329a221cc0ae37d89d1fba11ea737.zip |
refactor(models/attachement): use getAttachmentsByUUIDs (#9317)
Diffstat (limited to 'models/release.go')
-rw-r--r-- | models/release.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/models/release.go b/models/release.go index f43d81d822..a0f0621ab0 100644 --- a/models/release.go +++ b/models/release.go @@ -129,16 +129,9 @@ func UpdateRelease(rel *Release) error { // AddReleaseAttachments adds a release attachments func AddReleaseAttachments(releaseID int64, attachmentUUIDs []string) (err error) { // Check attachments - var attachments = make([]*Attachment, 0) - for _, uuid := range attachmentUUIDs { - attach, err := getAttachmentByUUID(x, uuid) - if err != nil { - if IsErrAttachmentNotExist(err) { - continue - } - return fmt.Errorf("getAttachmentByUUID [%s]: %v", uuid, err) - } - attachments = append(attachments, attach) + attachments, err := GetAttachmentsByUUIDs(attachmentUUIDs) + if err != nil { + return fmt.Errorf("GetAttachmentsByUUIDs [uuids: %v]: %v", attachmentUUIDs, err) } for i := range attachments { |