diff --git a/backend/app/service/cornjob.go b/backend/app/service/cornjob.go index 9c44b2b27..0a76ef48e 100644 --- a/backend/app/service/cornjob.go +++ b/backend/app/service/cornjob.go @@ -81,11 +81,11 @@ func (u *CronjobService) SearchRecords(search dto.SearchRecord) (int64, interfac } func (u *CronjobService) CleanRecord(req dto.CronjobClean) error { - if req.CleanData { - cronjob, err := cronjobRepo.Get(commonRepo.WithByID(req.CronjobID)) - if err != nil { - return err - } + cronjob, err := cronjobRepo.Get(commonRepo.WithByID(req.CronjobID)) + if err != nil { + return err + } + if req.CleanData && cronjob.Type != "shell" && cronjob.Type != "curl" { cronjob.RetainCopies = 0 backup, err := backupRepo.Get(commonRepo.WithByID(uint(cronjob.TargetDirID))) if err != nil {