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:
@ -262,11 +262,18 @@ class Resource extends BaseItem {
|
||||
await this.db().exec('INSERT INTO resources_to_download (resource_id, updated_time, created_time) SELECT ?, ?, ? WHERE NOT EXISTS (SELECT 1 FROM resources_to_download WHERE resource_id = ?)', [resourceId, t, t, resourceId]);
|
||||
}
|
||||
|
||||
static async downloadedButEncryptedBlobCount() {
|
||||
static async downloadedButEncryptedBlobCount(excludedIds = null) {
|
||||
let excludedSql = '';
|
||||
if (excludedIds && excludedIds.length) {
|
||||
excludedSql = `AND resource_id NOT IN ("${excludedIds.join('","')}")`;
|
||||
}
|
||||
|
||||
const r = await this.db().selectOne(`
|
||||
SELECT count(*) as total
|
||||
FROM resource_local_states
|
||||
WHERE fetch_status = ? AND resource_id IN (SELECT id FROM resources WHERE encryption_blob_encrypted = 1)
|
||||
WHERE fetch_status = ?
|
||||
AND resource_id IN (SELECT id FROM resources WHERE encryption_blob_encrypted = 1)
|
||||
${excludedSql}
|
||||
`, [Resource.FETCH_STATUS_DONE]);
|
||||
|
||||
return r ? r.total : 0;
|
||||
|
Reference in New Issue
Block a user