1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

All: Handle missing resource blob when setting resource size

This commit is contained in:
Laurent Cozic 2019-05-19 11:18:44 +01:00
parent e4a08c29d7
commit 07e88b2eeb

View File

@ -113,6 +113,10 @@ class ResourceService extends BaseService {
static async autoSetFileSize(resourceId, 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);
await Resource.setFileSizeOnly(resourceId, fileStat.size);
}