diff options
author | 6543 <6543@obermui.de> | 2022-03-03 12:51:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-03 19:51:13 +0800 |
commit | eddd2fb242589107714968809911071eb2e516e7 (patch) | |
tree | fc3aa88186fea5aae8776eee5179efbcc1147403 /models/repo.go | |
parent | f3cbdee38e5111886a8ab0855be615ba180c45dc (diff) | |
download | gitea-eddd2fb242589107714968809911071eb2e516e7.tar.gz gitea-eddd2fb242589107714968809911071eb2e516e7.zip |
fix & refactor (#18973)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models/repo.go')
-rw-r--r-- | models/repo.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/models/repo.go b/models/repo.go index 821b60d08d..4b2221e643 100644 --- a/models/repo.go +++ b/models/repo.go @@ -956,28 +956,28 @@ func DeleteRepository(doer *user_model.User, uid, repoID int64) error { } // Remove archives - for i := range archivePaths { - admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.RepoArchives, "Delete repo archive file", archivePaths[i]) + for _, archive := range archivePaths { + admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.RepoArchives, "Delete repo archive file", archive) } // Remove lfs objects - for i := range lfsPaths { - admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.LFS, "Delete orphaned LFS file", lfsPaths[i]) + for _, lfsObj := range lfsPaths { + admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.LFS, "Delete orphaned LFS file", lfsObj) } // Remove issue attachment files. - for i := range attachmentPaths { - admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", attachmentPaths[i]) + for _, attachment := range attachmentPaths { + admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", attachment) } // Remove release attachment files. - for i := range releaseAttachments { - admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete release attachment", releaseAttachments[i]) + for _, releaseAttachment := range releaseAttachments { + admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete release attachment", releaseAttachment) } // Remove attachment with no issue_id and release_id. - for i := range newAttachmentPaths { - admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", attachmentPaths[i]) + for _, newAttachment := range newAttachmentPaths { + admin_model.RemoveStorageWithNotice(db.DefaultContext, storage.Attachments, "Delete issue attachment", newAttachment) } if len(repo.Avatar) > 0 { |