You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Fixes #2257: Prevent decryption loop when a resource cannot be decrypted
This commit is contained in:
@ -3,6 +3,7 @@ const Tag = require('lib/models/Tag');
|
||||
const Note = require('lib/models/Note');
|
||||
const { reg } = require('lib/registry.js');
|
||||
const ResourceFetcher = require('lib/services/ResourceFetcher');
|
||||
const DecryptionWorker = require('lib/services/DecryptionWorker');
|
||||
|
||||
const reduxSharedMiddleware = async function(store, next, action) {
|
||||
const newState = store.getState();
|
||||
@ -21,6 +22,17 @@ const reduxSharedMiddleware = async function(store, next, action) {
|
||||
ResourceFetcher.instance().autoAddResources();
|
||||
}
|
||||
|
||||
// In general the DecryptionWorker is started via events, such as when an encrypted note
|
||||
// is received via sync, or after an encrypted has been downloaded. However, in some cases,
|
||||
// in particular when an item cannot be decrypted, the service won't retry automatically,
|
||||
// since it's not useful because the data most likely is corrupted. In some
|
||||
// cases the user might want to retry anyway, so we enable this by starting the service
|
||||
// automatically after each full sync (which is triggered when the user presses the sync
|
||||
// button, but not when a note is saved).
|
||||
if (action.type === 'SYNC_COMPLETED' && action.isFullSync) {
|
||||
DecryptionWorker.instance().scheduleStart();
|
||||
}
|
||||
|
||||
if (action.type == 'NOTE_DELETE' ||
|
||||
action.type == 'NOTE_UPDATE_ONE' ||
|
||||
action.type == 'NOTE_UPDATE_ALL' ||
|
||||
|
Reference in New Issue
Block a user