You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Fixed detection of encrypted item
This commit is contained in:
@ -507,7 +507,8 @@ class EncryptionService {
|
||||
}
|
||||
|
||||
isValidHeaderIdentifier(id, ignoreTooLongLength = false) {
|
||||
if (!ignoreTooLongLength && !id || id.length !== 5) return false;
|
||||
if (!id) return false;
|
||||
if (!ignoreTooLongLength && id.length !== 5) return false;
|
||||
return /JED\d\d/.test(id);
|
||||
}
|
||||
|
||||
@ -515,7 +516,7 @@ class EncryptionService {
|
||||
if (!item) throw new Error('No item');
|
||||
const ItemClass = BaseItem.itemClass(item);
|
||||
if (!ItemClass.encryptionSupported()) return false;
|
||||
return item.encryption_applied && this.isValidHeaderIdentifier(item.encryption_cipher_text);
|
||||
return item.encryption_applied && this.isValidHeaderIdentifier(item.encryption_cipher_text, true);
|
||||
}
|
||||
|
||||
async fileIsEncrypted(path) {
|
||||
|
Reference in New Issue
Block a user