mirror of
https://github.com/laurent22/joplin.git
synced 2024-11-27 08:21:03 +02:00
CLI: Fixed regression which was preventing decryption on newly created profiles
This commit is contained in:
parent
7c6c7f34ba
commit
62c48b9a46
@ -3,5 +3,4 @@ set -e
|
||||
CLIENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
bash "$CLIENT_DIR/build.sh" && node "$CLIENT_DIR/build/main.js" --profile ~/Temp/TestNotes2 --stack-trace-enabled --log-level debug --env dev "$@"
|
||||
|
||||
# bash $CLIENT_DIR/build.sh && NODE_PATH="$CLIENT_DIR/build/" node build/main.js --profile ~/.config/joplin --stack-trace-enabled --log-level debug "$@"
|
||||
# bash "$CLIENT_DIR/build.sh" && node "$CLIENT_DIR/build/main.js" --profile ~/.config/joplin --stack-trace-enabled --log-level debug --env dev "$@"
|
@ -106,16 +106,25 @@ class DecryptionWorker {
|
||||
return;
|
||||
}
|
||||
|
||||
// Note: the logic below is an optimisation to avoid going through the loop if no master key exists
|
||||
// or if none is loaded. It means this logic needs to be duplicate a bit what's in the loop, like the
|
||||
// "throw" and "dispatch" logic.
|
||||
const loadedMasterKeyCount = await this.encryptionService().loadedMasterKeysCount();
|
||||
if (!loadedMasterKeyCount) {
|
||||
this.logger().info('DecryptionWorker: cannot start because no master key is currently loaded.');
|
||||
const ids = await MasterKey.allIds();
|
||||
|
||||
if (ids.length) {
|
||||
this.dispatch({
|
||||
type: 'MASTERKEY_SET_NOT_LOADED',
|
||||
ids: ids,
|
||||
});
|
||||
if (options.masterKeyNotLoadedHandler === 'throw') {
|
||||
// By trying to load the master key here, we throw the "masterKeyNotLoaded" error
|
||||
// which the caller needs.
|
||||
await this.encryptionService().loadedMasterKey(ids[0]);
|
||||
} else {
|
||||
this.dispatch({
|
||||
type: 'MASTERKEY_SET_NOT_LOADED',
|
||||
ids: ids,
|
||||
});
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user