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

Improved logic to set resource file size

This commit is contained in:
Laurent Cozic
2019-05-12 15:53:42 +01:00
parent e57bfad9b1
commit 3e808f05fd
6 changed files with 61 additions and 6 deletions

View File

@ -6,6 +6,7 @@ const Setting = require('lib/models/Setting.js');
const ArrayUtils = require('lib/ArrayUtils.js');
const pathUtils = require('lib/path-utils.js');
const { mime } = require('lib/mime-utils.js');
const { shim } = require('lib/shim');
const { filename, safeFilename } = require('lib/path-utils.js');
const { FsDriverDummy } = require('lib/fs-driver-dummy.js');
const markdownUtils = require('lib/markdownUtils');
@ -214,6 +215,10 @@ class Resource extends BaseItem {
await ResourceLocalState.save(Object.assign({}, state, { resource_id: id }));
}
static async needFileSizeSet() {
return this.modelSelectAll('SELECT * FROM resources WHERE `size` < 0 AND encryption_blob_encrypted = 0');
}
// 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.