1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-01 03:24:14 +08:00

fix: 解决备份账号异常导致备份记录无法删除的问题 ()

Refs 
This commit is contained in:
ssongliu 2024-02-20 15:02:07 +08:00 committed by GitHub
parent 1781362342
commit e346442d36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -268,11 +268,13 @@ func (u *BackupService) BatchDeleteRecord(ids []uint) error {
for _, record := range records { for _, record := range records {
backupAccount, err := backupRepo.Get(commonRepo.WithByType(record.Source)) backupAccount, err := backupRepo.Get(commonRepo.WithByType(record.Source))
if err != nil { if err != nil {
return err global.LOG.Errorf("load backup account %s info from db failed, err: %v", record.Source, err)
continue
} }
client, err := u.NewClient(&backupAccount) client, err := u.NewClient(&backupAccount)
if err != nil { if err != nil {
return err global.LOG.Errorf("new client for backup account %s failed, err: %v", record.Source, err)
continue
} }
if _, err = client.Delete(path.Join(record.FileDir, record.FileName)); err != nil { if _, err = client.Delete(path.Join(record.FileDir, record.FileName)); err != nil {
global.LOG.Errorf("remove file %s from %s failed, err: %v", path.Join(record.FileDir, record.FileName), record.Source, err) global.LOG.Errorf("remove file %s from %s failed, err: %v", path.Join(record.FileDir, record.FileName), record.Source, err)