From e00c7d32af10150287df1e7ad1c14fb19abe68a4 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 18 Jul 2025 18:12:42 -0700 Subject: [PATCH] improvements --- services/repository/delete.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/services/repository/delete.go b/services/repository/delete.go index e0669ec9ca5..9b3d1c07e85 100644 --- a/services/repository/delete.go +++ b/services/repository/delete.go @@ -291,9 +291,6 @@ func DeleteRepositoryDirectly(ctx context.Context, repoID int64, ignoreOrgTeams committer.Close() - attachment_service.AddAttachmentsToCleanQueue(ctx, releaseAttachments) - attachment_service.AddAttachmentsToCleanQueue(ctx, repoAttachments) - if needRewriteKeysFile { if err := asymkey_service.RewriteAllPublicKeys(ctx); err != nil { log.Error("RewriteAllPublicKeys failed: %v", err) @@ -327,14 +324,8 @@ func DeleteRepositoryDirectly(ctx context.Context, repoID int64, ignoreOrgTeams system_model.RemoveStorageWithNotice(ctx, storage.LFS, "Delete orphaned LFS file", lfsObj) } - // Remove release attachments - for _, attachment := range releaseAttachments { - system_model.RemoveStorageWithNotice(ctx, storage.Attachments, "Delete release attachment", attachment.RelativePath()) - } - // Remove attachment with repo_id = repo.ID. - for _, attachment := range repoAttachments { - system_model.RemoveStorageWithNotice(ctx, storage.Attachments, "Delete repo attachment", attachment.RelativePath()) - } + attachment_service.AddAttachmentsToCleanQueue(ctx, releaseAttachments) + attachment_service.AddAttachmentsToCleanQueue(ctx, repoAttachments) if len(repo.Avatar) > 0 { if err := storage.RepoAvatars.Delete(repo.CustomAvatarRelativePath()); err != nil {