mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-31 14:08:06 +08:00
fix: 解决计划任务保存到第三方备份账号不生效的问题
This commit is contained in:
parent
791641f3e1
commit
2896409b3a
@ -118,6 +118,8 @@ func (u *CronjobService) HandleBackup(cronjob *model.Cronjob, startTime time.Tim
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
|
||||
itemFileDir := strings.ReplaceAll(backupDir, localDir+"/", "")
|
||||
if len(record.Name) != 0 {
|
||||
record.FileName = fileName
|
||||
record.FileDir = backupDir
|
||||
@ -125,7 +127,7 @@ func (u *CronjobService) HandleBackup(cronjob *model.Cronjob, startTime time.Tim
|
||||
record.BackupType = backup.Type
|
||||
if !cronjob.KeepLocal && backup.Type != "LOCAL" {
|
||||
record.Source = backup.Type
|
||||
record.FileDir = strings.ReplaceAll(backupDir, localDir+"/", "")
|
||||
record.FileDir = itemFileDir
|
||||
}
|
||||
if err := backupRepo.CreateRecord(&record); err != nil {
|
||||
global.LOG.Errorf("save backup record failed, err: %v", err)
|
||||
@ -148,10 +150,13 @@ func (u *CronjobService) HandleBackup(cronjob *model.Cronjob, startTime time.Tim
|
||||
if err != nil {
|
||||
return fullPath, err
|
||||
}
|
||||
if _, err = client.Upload(backupDir+"/"+fileName, fullPath); err != nil {
|
||||
if _, err = client.Upload(backupDir+"/"+fileName, itemFileDir+"/"+fileName); err != nil {
|
||||
return fullPath, err
|
||||
}
|
||||
u.HandleRmExpired(backup.Type, backupDir, cronjob, client)
|
||||
u.HandleRmExpired(backup.Type, itemFileDir, cronjob, client)
|
||||
if cronjob.KeepLocal {
|
||||
u.HandleRmExpired("LOCAL", backupDir, cronjob, client)
|
||||
}
|
||||
return fullPath, nil
|
||||
}
|
||||
|
||||
@ -185,10 +190,8 @@ func (u *CronjobService) HandleRmExpired(backType, backupDir string, cronjob *mo
|
||||
for i := 0; i < len(currentObjs)-int(cronjob.RetainCopies); i++ {
|
||||
_, _ = backClient.Delete(currentObjs[i].(string))
|
||||
}
|
||||
if !cronjob.KeepLocal {
|
||||
return
|
||||
}
|
||||
}
|
||||
files, err := ioutil.ReadDir(backupDir)
|
||||
if err != nil {
|
||||
global.LOG.Errorf("read dir %s failed, err: %v", backupDir, err)
|
||||
|
1
frontend/components.d.ts
vendored
1
frontend/components.d.ts
vendored
@ -64,7 +64,6 @@ declare module 'vue' {
|
||||
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
|
||||
ElSwitch: typeof import('element-plus/es')['ElSwitch']
|
||||
ElTable: typeof import('element-plus/es')['ElTable']
|
||||
ElTableColmn: typeof import('element-plus/es')['ElTableColmn']
|
||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||
ElTabPane: typeof import('element-plus/es')['ElTabPane']
|
||||
ElTabs: typeof import('element-plus/es')['ElTabs']
|
||||
|
@ -54,13 +54,13 @@ export const loadBaseDir = () => {
|
||||
|
||||
// backup
|
||||
export const handleBackup = (params: Backup.Backup) => {
|
||||
return http.post(`/settings/backup/backup`, params);
|
||||
return http.post(`/settings/backup/backup`, params, 400000);
|
||||
};
|
||||
export const handleRecover = (params: Backup.Recover) => {
|
||||
return http.post(`/settings/backup/recover`, params);
|
||||
return http.post(`/settings/backup/recover`, params, 400000);
|
||||
};
|
||||
export const handleRecoverByUpload = (params: Backup.Recover) => {
|
||||
return http.post(`/settings/backup/recover/byupload`, params);
|
||||
return http.post(`/settings/backup/recover/byupload`, params, 400000);
|
||||
};
|
||||
export const downloadBackupRecord = (params: Backup.RecordDownload) => {
|
||||
return http.download<BlobPart>(`/settings/backup/record/download`, params, { responseType: 'blob' });
|
||||
|
@ -119,7 +119,11 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
||||
if (type.value === 'website' || type.value === 'app') {
|
||||
title.value = name.value;
|
||||
}
|
||||
if (detailName.value) {
|
||||
baseDir.value = `${pathRes.data}/uploads/${type.value}/${name.value}/${detailName.value}/`;
|
||||
} else {
|
||||
baseDir.value = `${pathRes.data}/uploads/${type.value}/${name.value}/`;
|
||||
}
|
||||
upVisiable.value = true;
|
||||
search();
|
||||
};
|
||||
@ -198,7 +202,7 @@ const onSubmit = async () => {
|
||||
MsgError(i18n.global.t('commons.msg.fileNameErr'));
|
||||
return;
|
||||
}
|
||||
let reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-z:A-Z0-9_.\u4e00-\u9fa5-]{0,50}$/;
|
||||
let reg = /^[a-zA-Z0-9\u4e00-\u9fa5]{1}[a-z:A-Z0-9_.\u4e00-\u9fa5-]{0,256}$/;
|
||||
if (!reg.test(uploaderFiles.value[0]!.raw.name)) {
|
||||
MsgError(i18n.global.t('commons.msg.fileNameErr'));
|
||||
return;
|
||||
|
@ -97,7 +97,7 @@ const message = {
|
||||
unSupportSize: 'The uploaded file exceeds {0}M, please confirm!',
|
||||
fileExist: 'The file already exists in the current folder. Repeat uploading is not supported!',
|
||||
fileNameErr:
|
||||
'You can upload only files whose name contains 1 to 50 characters, including English, Chinese, digits, or periods (.-_)',
|
||||
'You can upload only files whose name contains 1 to 256 characters, including English, Chinese, digits, or periods (.-_)',
|
||||
comfimNoNull: 'Make sure the value {0} is not empty',
|
||||
},
|
||||
login: {
|
||||
|
@ -102,7 +102,7 @@ const message = {
|
||||
unSupportType: '不支持当前文件类型!',
|
||||
unSupportSize: '上传文件超过 {0}M,请确认!',
|
||||
fileExist: '当前文件夹已存在该文件,不支持重复上传!',
|
||||
fileNameErr: '仅支持上传名称包含英文、中文、数字或者 .-_ ,长度 1-50 位的文件',
|
||||
fileNameErr: '仅支持上传名称包含英文、中文、数字或者 .-_ ,长度 1-256 位的文件',
|
||||
comfimNoNull: '请确认 {0} 值不为空',
|
||||
},
|
||||
login: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user