Skip to content

Commit eddd2fb

Browse files
6543lunny
andauthored
fix & refactor (#18973)
Co-authored-by: Lunny Xiao <[email protected]>
1 parent f3cbdee commit eddd2fb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

models/repo.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -956,28 +956,28 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error {
956956
}
957957

958958
// Remove archives
959-
for i := range archivePaths {
960-
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.RepoArchives, "Delete repo archive file", archivePaths[i])
959+
for _, archive := range archivePaths {
960+
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.RepoArchives, "Delete repo archive file", archive)
961961
}
962962

963963
// Remove lfs objects
964-
for i := range lfsPaths {
965-
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.LFS, "Delete orphaned LFS file", lfsPaths[i])
964+
for _, lfsObj := range lfsPaths {
965+
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.LFS, "Delete orphaned LFS file", lfsObj)
966966
}
967967

968968
// Remove issue attachment files.
969-
for i := range attachmentPaths {
970-
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", attachmentPaths[i])
969+
for _, attachment := range attachmentPaths {
970+
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", attachment)
971971
}
972972

973973
// Remove release attachment files.
974-
for i := range releaseAttachments {
975-
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete release attachment", releaseAttachments[i])
974+
for _, releaseAttachment := range releaseAttachments {
975+
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete release attachment", releaseAttachment)
976976
}
977977

978978
// Remove attachment with no issue_id and release_id.
979-
for i := range newAttachmentPaths {
980-
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", attachmentPaths[i])
979+
for _, newAttachment := range newAttachmentPaths {
980+
admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", newAttachment)
981981
}
982982

983983
if len(repo.Avatar) > 0 {

0 commit comments

Comments
 (0)