Skip to content

Commit

Permalink
fix: Ember: automatically rename/ignore unsupported backup versions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerivec authored Jun 9, 2024
1 parent b72481c commit 9092fe5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/adapter/ember/adapter/emberAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* istanbul ignore file */
import equals from 'fast-deep-equal/es6';
import {existsSync, readFileSync} from 'fs';
import {existsSync, readFileSync, renameSync} from 'fs';
import path from 'path';
import SerialPortUtils from '../../serialPortUtils';
import SocketPortUtils from '../../socketPortUtils';
Expand Down Expand Up @@ -1360,7 +1360,9 @@ export class EmberAdapter extends Adapter {
}

if (data.metadata.internal.ezspVersion < BACKUP_OLDEST_SUPPORTED_EZSP_VERSION) {
throw new Error(`[BACKUP] Current backup file is from an unsupported EZSP version (min: ${BACKUP_OLDEST_SUPPORTED_EZSP_VERSION}).`);
renameSync(this.backupPath, `${this.backupPath}.old`);
logger.warning(`[BACKUP] Current backup file is from an unsupported EZSP version. Renaming and ignoring.`, NS);
return null;
}

return BackupUtils.fromUnifiedBackup(data);
Expand Down

0 comments on commit 9092fe5

Please sign in to comment.