Skip to content

Commit

Permalink
FIX: realm encryption mismatch after backup restore (closes #3332)
Browse files Browse the repository at this point in the history
  • Loading branch information
Overtorment committed Aug 15, 2021
1 parent d11fc7e commit 9b45c53
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions class/app-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,10 @@ export class AppStorage {
} catch (error) {
console.error('save to disk exception:', error.message);
alert('save to disk exception: ' + error.message);
if (error.message.includes('Realm file decryption failed')) {
console.warn('purging realm key-value database file');
this.purgeRealmKeyValueFile();
}
} finally {
savingInProgress = 0;
}
Expand Down Expand Up @@ -796,4 +800,11 @@ export class AppStorage {
sleep = ms => {
return new Promise(resolve => setTimeout(resolve, ms));
};

async purgeRealmKeyValueFile() {
const path = 'keyvalue.realm';
return Realm.deleteFile({
path,
});
}
}

0 comments on commit 9b45c53

Please sign in to comment.