diff --git a/CHANGELOG.md b/CHANGELOG.md index 726864bc20..b84b3194e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ --> ## __WORK IN PROGRESS__ - Lucy +* (@foxriver76) fixed crash case on database migration * (@foxriver76) fixed edge case crash cases if notifications are processed nearly simultaneously ## 7.0.0 (2024-10-06) - Lucy diff --git a/packages/cli/src/lib/setup/setupBackup.ts b/packages/cli/src/lib/setup/setupBackup.ts index 9508074942..64ab44e869 100644 --- a/packages/cli/src/lib/setup/setupBackup.ts +++ b/packages/cli/src/lib/setup/setupBackup.ts @@ -256,7 +256,7 @@ export class BackupRestore { * @param name - name of the backup * @param noConfig - do not store configs (used by setup custom migration) */ - async createBackup(name: string, noConfig?: boolean): Promise { + async createBackup(name: string, noConfig = false): Promise { if (!name) { const d = new Date(); name = `${d.getFullYear()}_${`0${d.getMonth() + 1}`.slice(-2)}_${`0${d.getDate()}`.slice(-2)}-${`0${d.getHours()}`.slice( @@ -367,7 +367,7 @@ export class BackupRestore { console.log(`host.${hostname} Validating backup ...`); try { - await this._validateBackupAfterCreation(); + await this._validateBackupAfterCreation(noConfig); console.log(`host.${hostname} The backup is valid!`); return await this._packBackup(name); @@ -967,10 +967,15 @@ export class BackupRestore { /** * Validates the backup.json and all json files inside the backup after (in temporary directory), here we only abort if backup.json is corrupted + * + * @param noConfig if the backup does not contain a `config.json` (used by setup custom migration) */ - private async _validateBackupAfterCreation(): Promise { + private async _validateBackupAfterCreation(noConfig = false): Promise { const backupBaseDir = path.join(this.tmpDir, 'backup'); - await fs.readJSON(path.join(backupBaseDir, 'config.json')); + + if (!noConfig) { + await fs.readJSON(path.join(backupBaseDir, 'config.json')); + } if (!(await fs.pathExists(path.join(backupBaseDir, 'objects.jsonl')))) { throw new Error('Backup does not contain valid objects');