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

fix: 解决计划任务本地保存份数错误的问题 (#4692)

Refs #4671
This commit is contained in:
ssongliu 2024-04-25 10:31:10 +08:00 committed by GitHub
parent 9cd37e8ec5
commit 94405d877f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 17 deletions

View File

@ -2,7 +2,6 @@ package service
import (
"context"
"encoding/json"
"fmt"
"os"
"path"
@ -276,21 +275,6 @@ func loadClientMap(backupAccounts string) (map[string]cronjobUploadHelper, error
if account.BackupPath != "/" {
pathItem = strings.TrimPrefix(account.BackupPath, "/")
}
if target == constant.Local {
varMap := make(map[string]interface{})
if err := json.Unmarshal([]byte(account.Vars), &varMap); err != nil {
return nil, err
}
if _, ok := varMap["dir"]; !ok {
return nil, errors.New("load local backup dir failed")
}
baseDir, ok := varMap["dir"].(string)
if ok {
pathItem = baseDir
} else {
return nil, fmt.Errorf("error type dir: %T", varMap["dir"])
}
}
clients[target] = cronjobUploadHelper{
client: client,
backupPath: pathItem,

View File

@ -54,7 +54,7 @@ func (c localClient) Upload(src, target string) (bool, error) {
}
}
if err := common.CopyFile(src, target); err != nil {
if err := common.CopyFile(src, targetFilePath); err != nil {
return false, fmt.Errorf("cp file failed, err: %v", err)
}
return true, nil