diff --git a/src/system.js b/src/system.js index cc7f970d2..69854419f 100644 --- a/src/system.js +++ b/src/system.js @@ -125,19 +125,22 @@ async function getFilesystems() { filesystems[diskInfo.filesystem].contents.push(stdPath); } - for (const backupSite of await backupSites.list()) { + const sites = await backupSites.list(); + for (const backupSite of sites) { if (backupSite.provider === 'filesystem') { const [, dfResult] = await safe(df.file(backupSite.config.backupDir)); const filesystem = dfResult?.filesystem || rootDisk.filesystem; if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup', id: backupSite.id, path: backupSite.config.backupDir }); } - // often the default backup dir is not cleaned up - if (backupSite.provider !== 'filesystem' || backupSite.config.backupDir !== paths.DEFAULT_BACKUP_DIR) { - const [, dfResult] = await safe(df.file(paths.DEFAULT_BACKUP_DIR)); - const filesystem = dfResult?.filesystem || rootDisk.filesystem; - if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', path: paths.DEFAULT_BACKUP_DIR }); - } + } + + // often the default backup dir is not cleaned up + const siteForDefault = sites.find(s => s.provider === 'filesystem' && s.config.backupDir === paths.DEFAULT_BACKUP_DIR); + if (!siteForDefault) { + const [, dfResult] = await safe(df.file(paths.DEFAULT_BACKUP_DIR)); + const filesystem = dfResult?.filesystem || rootDisk.filesystem; + if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', path: paths.DEFAULT_BACKUP_DIR }); } const [dockerError, dockerInfo] = await safe(docker.info());