Skip to content

Commit c1908f4

Browse files
committed
remove conditional should in case the confi has been changed and the server restarted
1 parent 797f275 commit c1908f4

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

models/release.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -370,22 +370,19 @@ func DeleteReleaseByID(id int64, doer *User, delTag bool) error {
370370
go HookQueue.Add(rel.Repo.ID)
371371
}
372372

373-
if setting.AttachmentEnabled {
373+
uuids := make([]string, 0, len(rel.Attachments))
374374

375-
uuids := make([]string, 0, len(rel.Attachments))
376-
377-
for i := range rel.Attachments {
378-
attachment := rel.Attachments[i]
379-
if err := os.RemoveAll(attachment.LocalPath()); err != nil {
380-
return err
381-
}
382-
383-
uuids = append(uuids, attachment.UUID)
384-
}
385-
386-
if _, err := x.In("uuid", uuids).Delete(new(Attachment)); err != nil {
375+
for i := range rel.Attachments {
376+
attachment := rel.Attachments[i]
377+
if err := os.RemoveAll(attachment.LocalPath()); err != nil {
387378
return err
388379
}
380+
381+
uuids = append(uuids, attachment.UUID)
382+
}
383+
384+
if _, err := x.In("uuid", uuids).Delete(new(Attachment)); err != nil {
385+
return err
389386
}
390387

391388
return nil

0 commit comments

Comments
 (0)