1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

All: Make sure resource filesize is set in all cases

This commit is contained in:
Laurent Cozic
2019-05-12 11:41:07 +01:00
parent ed3970be81
commit e1b7b64e1b
10 changed files with 66 additions and 9 deletions

View File

@@ -214,6 +214,13 @@ class Resource extends BaseItem {
await ResourceLocalState.save(Object.assign({}, state, { resource_id: id }));
}
// Only set the `size` field and nothing else, not even the update_time
// This is because it's only necessary to do it once after migration 20
// and each client does it so there's no need to sync the resource.
static async setFileSizeOnly(resourceId, fileSize) {
return this.db().exec('UPDATE resources set `size` = ? WHERE id = ?', [fileSize, resourceId]);
}
static async batchDelete(ids, options = null) {
// For resources, there's not really batch deleting since there's the file data to delete
// too, so each is processed one by one with the item being deleted last (since the db