mirror of
https://github.com/laurent22/joplin.git
synced 2025-04-26 12:02:59 +02:00
All: Handle missing resource blob when setting resource size
This commit is contained in:
parent
e4a08c29d7
commit
07e88b2eeb
@ -113,6 +113,10 @@ class ResourceService extends BaseService {
|
|||||||
|
|
||||||
static async autoSetFileSize(resourceId, filePath) {
|
static async autoSetFileSize(resourceId, filePath) {
|
||||||
const itDoes = await shim.fsDriver().waitTillExists(filePath);
|
const itDoes = await shim.fsDriver().waitTillExists(filePath);
|
||||||
|
if (!itDoes) {
|
||||||
|
this.logger().warn('Trying to set file size on non-existent resource:', resourceId, filePath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const fileStat = await shim.fsDriver().stat(filePath);
|
const fileStat = await shim.fsDriver().stat(filePath);
|
||||||
await Resource.setFileSizeOnly(resourceId, fileStat.size);
|
await Resource.setFileSizeOnly(resourceId, fileStat.size);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user