fix: Fix temporary file leak during snapshot deletion (#10052)

This commit is contained in:
ssongliu 2025-08-19 14:58:18 +08:00 committed by GitHub
parent 19fa30fb96
commit 1ade1b8d8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -156,6 +156,7 @@ func (u *SnapshotService) Delete(req dto.SnapshotBatchDelete) error {
}
_ = backupRepo.DeleteRecord(context.Background(), repo.WithByType("snapshot"), backupRepo.WithByFileName(snap.Name+".tar.gz"))
}
_ = os.Remove(path.Join(global.Dir.LocalBackupDir, "tmp/system", snap.Name+".tar.gz"))
if err := snapshotRepo.Delete(repo.WithByID(snap.ID)); err != nil {
return err