@@ -1993,7 +1993,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
1993
1993
}
1994
1994
1995
1995
releaseAttachments := make ([]string , 0 , 20 )
1996
- attachments := make ([]* Attachment , 0 , len (releaseAttachments ))
1996
+ attachments := make ([]* Attachment , 0 , cap (releaseAttachments ))
1997
1997
if err = sess .Join ("INNER" , "release" , "release.id = attachment.release_id" ).
1998
1998
Where ("release.repo_id = ?" , repoID ).
1999
1999
Find (& attachments ); err != nil {
@@ -2054,7 +2054,7 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
2054
2054
}
2055
2055
2056
2056
attachmentPaths := make ([]string , 0 , 20 )
2057
- attachments = make ([] * Attachment , 0 , len ( attachmentPaths ))
2057
+ attachments = attachments [: 0 ]
2058
2058
if err = sess .Join ("INNER" , "issue" , "issue.id = attachment.issue_id" ).
2059
2059
Where ("issue.repo_id = ?" , repoID ).
2060
2060
Find (& attachments ); err != nil {
@@ -2146,10 +2146,8 @@ func DeleteRepository(doer *User, uid, repoID int64) error {
2146
2146
}
2147
2147
2148
2148
// Remove release attachment files.
2149
- if len (releaseAttachments ) > 0 {
2150
- for i := range releaseAttachments {
2151
- removeAllWithNotice (x , "Delete release attachment" , releaseAttachments [i ])
2152
- }
2149
+ for i := range releaseAttachments {
2150
+ removeAllWithNotice (x , "Delete release attachment" , releaseAttachments [i ])
2153
2151
}
2154
2152
2155
2153
if len (repo .Avatar ) > 0 {
0 commit comments