diff --git a/backend/utils/cloud_storage/client/local.go b/backend/utils/cloud_storage/client/local.go index 7028f54c0..40e8a49be 100644 --- a/backend/utils/cloud_storage/client/local.go +++ b/backend/utils/cloud_storage/client/local.go @@ -81,8 +81,11 @@ func (c localClient) Download(src, target string) (bool, error) { } func (c localClient) ListObjects(prefix string) ([]string, error) { - itemPath := path.Join(c.dir, prefix) var files []string + itemPath := path.Join(c.dir, prefix) + if _, err := os.Stat(itemPath); err != nil { + return files, nil + } if err := filepath.Walk(itemPath, func(path string, info os.FileInfo, err error) error { if !info.IsDir() { files = append(files, info.Name()) diff --git a/frontend/src/views/cronjob/operate/index.vue b/frontend/src/views/cronjob/operate/index.vue index 8646d7274..6c2a60a33 100644 --- a/frontend/src/views/cronjob/operate/index.vue +++ b/frontend/src/views/cronjob/operate/index.vue @@ -253,7 +253,7 @@ multiple class="selectClass" v-model="dialogData.rowData!.backupAccountList" - @change="changeAccount(true)" + @change="changeAccount" >
@@ -523,24 +523,28 @@ const loadBackups = async () => { } backupOptions.value.push({ label: i18n.global.t('setting.' + item.type), value: item.type }); } - changeAccount(false); + changeAccount(); }; -const changeAccount = async (handleChange: boolean) => { +const changeAccount = async () => { accountOptions.value = []; + let isInAccounts = false; for (const item of backupOptions.value) { - let exit = false; + let exist = false; for (const ac of dialogData.value.rowData.backupAccountList) { if (item.value == ac) { - exit = true; + exist = true; break; } } - if (exit) { + if (exist) { + if (item.value === dialogData.value.rowData.defaultDownload) { + isInAccounts = true; + } accountOptions.value.push(item); } } - if (handleChange) { + if (!isInAccounts) { dialogData.value.rowData.defaultDownload = ''; } }; diff --git a/frontend/src/views/setting/snapshot/index.vue b/frontend/src/views/setting/snapshot/index.vue index 7bf4756a3..f2128559f 100644 --- a/frontend/src/views/setting/snapshot/index.vue +++ b/frontend/src/views/setting/snapshot/index.vue @@ -296,18 +296,25 @@ const loadBackups = async () => { const changeAccount = async () => { accountOptions.value = []; + let isInAccounts = false; for (const item of backupOptions.value) { - let exit = false; + let exist = false; for (const ac of snapInfo.fromAccounts) { if (item.value == ac) { - exit = true; + exist = true; break; } } - if (exit) { + if (exist) { + if (item.value === snapInfo.defaultDownload) { + isInAccounts = true; + } accountOptions.value.push(item); } } + if (!isInAccounts) { + snapInfo.defaultDownload = ''; + } }; const batchDelete = async (row: Setting.SnapshotInfo | null) => {