1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

All: Added fail-safe to prevent data from being wiped out when the sync target is empty

This commit is contained in:
Laurent Cozic
2019-09-25 18:40:04 +00:00
parent 3e5a9cdb97
commit 348efdd7b6
5 changed files with 32 additions and 2 deletions

View File

@ -3,6 +3,7 @@ const Folder = require('lib/models/Folder.js');
const Note = require('lib/models/Note.js');
const Resource = require('lib/models/Resource.js');
const ItemChange = require('lib/models/ItemChange.js');
const Setting = require('lib/models/Setting.js');
const ResourceLocalState = require('lib/models/ResourceLocalState.js');
const MasterKey = require('lib/models/MasterKey.js');
const BaseModel = require('lib/BaseModel.js');
@ -508,6 +509,8 @@ class Synchronizer {
allItemIdsHandler: async () => {
return BaseItem.syncedItemIds(syncTargetId);
},
wipeOutFailSafe: Setting.value('sync.wipeOutFailSafe'),
});
let remotes = listResult.items;
@ -695,7 +698,7 @@ class Synchronizer {
}
} // DELTA STEP
} catch (error) {
if (error && ['cannotEncryptEncrypted', 'noActiveMasterKey', 'processingPathTwice'].indexOf(error.code) >= 0) {
if (error && ['cannotEncryptEncrypted', 'noActiveMasterKey', 'processingPathTwice', 'failSafe'].indexOf(error.code) >= 0) {
// Only log an info statement for this since this is a common condition that is reported
// in the application, and needs to be resolved by the user.
// Or it's a temporary issue that will be resolved on next sync.