mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-08-05 09:55:20 +02:00
refactor(models/attachement): use getAttachmentsByUUIDs (#9317)
This commit is contained in:
parent
50da9f7dae
commit
c3d31e5534
4 changed files with 23 additions and 20 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue