Page MenuHomePhabricator

D12013.id40227.diff
No OneTemporary

D12013.id40227.diff

diff --git a/native/backup/use-client-backup.js b/native/backup/use-client-backup.js
--- a/native/backup/use-client-backup.js
+++ b/native/backup/use-client-backup.js
@@ -9,6 +9,7 @@
import { fetchNativeKeychainCredentials } from '../account/native-credentials.js';
import { commCoreModule } from '../native-modules.js';
+import { persistConfig } from '../redux/persist.js';
import { useSelector } from '../redux/redux-utils.js';
type ClientBackup = {
@@ -89,6 +90,11 @@
const backupSecret = await getBackupSecret();
await commCoreModule.restoreBackup(backupSecret);
+ const backupVersion = await commCoreModule.getSyncedDatabaseVersion();
+ if (!backupVersion || parseInt(backupVersion) > persistConfig.version) {
+ throw new Error(`Incompatible backup version ${backupVersion ?? -1}`);
+ }
+
console.info('Backup restored.');
}, [currentUserID, loggedIn, setMockCommServicesAuthMetadata]);

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 6:36 AM (17 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693823
Default Alt Text
D12013.id40227.diff (937 B)

Event Timeline