You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
Improved logic to set resource file size
This commit is contained in:
@@ -111,6 +111,20 @@ class ResourceService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
static async autoSetFileSize(resourceId, filePath) {
|
||||
const itDoes = await shim.fsDriver().waitTillExists(filePath);
|
||||
const fileStat = await shim.fsDriver().stat(filePath);
|
||||
await Resource.setFileSizeOnly(resourceId, fileStat.size);
|
||||
}
|
||||
|
||||
static async autoSetFileSizes() {
|
||||
const resources = await Resource.needFileSizeSet();
|
||||
|
||||
for (const r of resources) {
|
||||
await this.autoSetFileSize(r.id, Resource.fullPath(r));
|
||||
}
|
||||
}
|
||||
|
||||
async maintenance() {
|
||||
await this.indexNoteResources();
|
||||
await this.deleteOrphanResources();
|
||||
|
||||
Reference in New Issue
Block a user