Skip to content

Commit 636b72a

Browse files
author
ssongliu
committed
fix: Fix the failure to back up file names containing Spaces for scheduled jobs
1 parent 220b622 commit 636b72a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

agent/app/service/cronjob_backup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ func (u *CronjobService) handleWebsite(cronjob model.Cronjob, startTime time.Tim
8383
record.Name = web.Alias
8484
record.DetailName = web.Alias
8585
record.DownloadAccountID, record.SourceAccountIDs = cronjob.DownloadAccountID, cronjob.SourceAccountIDs
86-
backupDir := path.Join(global.Dir.TmpDir, fmt.Sprintf("website/%s", web.PrimaryDomain))
87-
record.FileName = fmt.Sprintf("website_%s_%s.tar.gz", web.PrimaryDomain, startTime.Format(constant.DateTimeSlimLayout)+common.RandStrAndNum(5))
86+
backupDir := path.Join(global.Dir.TmpDir, fmt.Sprintf("website/%s", web.Alias))
87+
record.FileName = fmt.Sprintf("website_%s_%s.tar.gz", web.Alias, startTime.Format(constant.DateTimeSlimLayout)+common.RandStrAndNum(5))
8888
if err := handleWebsiteBackup(&web, backupDir, record.FileName, cronjob.ExclusionRules, cronjob.Secret, taskID); err != nil {
8989
return err
9090
}

agent/utils/files/file_op.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ func (f FileOp) TarGzFilesWithCompressPro(list []string, dst, secret string) err
768768

769769
var filelist []string
770770
for _, item := range list {
771-
filelist = append(filelist, "-C "+path.Dir(item)+" "+path.Base(item))
771+
filelist = append(filelist, "-C '"+path.Dir(item)+"' '"+path.Base(item)+"' ")
772772
}
773773
commands := ""
774774
if len(secret) != 0 {

0 commit comments

Comments
 (0)