@@ -358,6 +358,17 @@ func DeleteReleaseByID(id int64, doer *User, delTag bool) error {
358
358
return fmt .Errorf ("LoadAttributes: %v" , err )
359
359
}
360
360
361
+ if _ , err := x .Delete (& Attachment {ReleaseID : id }); err != nil {
362
+ return err
363
+ }
364
+
365
+ for i := range rel .Attachments {
366
+ attachment := rel .Attachments [i ]
367
+ if err := os .RemoveAll (attachment .LocalPath ()); err != nil {
368
+ return err
369
+ }
370
+ }
371
+
361
372
mode , _ := AccessLevel (doer , rel .Repo )
362
373
if err := PrepareWebhooks (rel .Repo , HookEventRelease , & api.ReleasePayload {
363
374
Action : api .HookReleaseDeleted ,
@@ -370,19 +381,7 @@ func DeleteReleaseByID(id int64, doer *User, delTag bool) error {
370
381
go HookQueue .Add (rel .Repo .ID )
371
382
}
372
383
373
- uuids := make ([]string , 0 , len (rel .Attachments ))
374
-
375
- for i := range rel .Attachments {
376
- attachment := rel .Attachments [i ]
377
- if err := os .RemoveAll (attachment .LocalPath ()); err != nil {
378
- return err
379
- }
380
-
381
- uuids = append (uuids , attachment .UUID )
382
- }
383
-
384
- _ , err := x .Delete (& Attachment {ReleaseID : id })
385
- return err
384
+ return nil
386
385
}
387
386
388
387
// SyncReleasesWithTags synchronizes release table with repository tags
0 commit comments