mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-11-10 03:30:53 +08:00
fix: Fix the problem of abnormal deletion of manual backup records (#8787)
Refs #8788
This commit is contained in:
parent
6ee2bf2bca
commit
fe6c2a2c76
1 changed files with 4 additions and 4 deletions
|
|
@ -132,12 +132,12 @@ func (u *BackupRecordService) DeleteRecordByName(backupType, name, detailName st
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
_, client, err := NewBackupClientWithID(record.DownloadAccountID)
|
backup, client, err := NewBackupClientWithID(record.DownloadAccountID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
global.LOG.Errorf("new client for backup account failed, err: %v", err)
|
global.LOG.Errorf("new client for backup account failed, err: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, err = client.Delete(path.Join(record.FileDir, record.FileName)); err != nil {
|
if _, err = client.Delete(path.Join(backup.BackupPath, record.FileDir, record.FileName)); err != nil {
|
||||||
global.LOG.Errorf("remove file %s failed, err: %v", path.Join(record.FileDir, record.FileName), err)
|
global.LOG.Errorf("remove file %s failed, err: %v", path.Join(record.FileDir, record.FileName), err)
|
||||||
}
|
}
|
||||||
_ = backupRepo.DeleteRecord(context.Background(), repo.WithByID(record.ID))
|
_ = backupRepo.DeleteRecord(context.Background(), repo.WithByID(record.ID))
|
||||||
|
|
@ -151,12 +151,12 @@ func (u *BackupRecordService) BatchDeleteRecord(ids []uint) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
_, client, err := NewBackupClientWithID(record.DownloadAccountID)
|
backup, client, err := NewBackupClientWithID(record.DownloadAccountID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
global.LOG.Errorf("new client for backup account failed, err: %v", err)
|
global.LOG.Errorf("new client for backup account failed, err: %v", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, err = client.Delete(path.Join(record.FileDir, record.FileName)); err != nil {
|
if _, err = client.Delete(path.Join(backup.BackupPath, record.FileDir, record.FileName)); err != nil {
|
||||||
global.LOG.Errorf("remove file %s failed, err: %v", path.Join(record.FileDir, record.FileName), err)
|
global.LOG.Errorf("remove file %s failed, err: %v", path.Join(record.FileDir, record.FileName), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue