diff --git a/back/models/image.js b/back/models/image.js index 78d159940..2187b5278 100644 --- a/back/models/image.js +++ b/back/models/image.js @@ -54,7 +54,7 @@ module.exports = Self => { }; await fs.mkdir(dstDir, {recursive: true}); - await sharp(srcFilePath, {failOnError: false}) + await sharp(srcFilePath) .resize(collection.maxWidth, collection.maxHeight, resizeOpts) .png() .toFile(dstFile); @@ -69,7 +69,7 @@ module.exports = Self => { }; await fs.mkdir(dstDir, {recursive: true}); - await sharp(srcFilePath, {failOnError: false}) + await sharp(srcFilePath) .resize(size.width, size.height, resizeOpts) .png() .toFile(dstFile); diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index e3412d6a8..cc1315e91 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -47,12 +47,7 @@ module.exports = Self => { if (!image) return; const srcFile = image.url.split('/').pop(); - const dotIndex = srcFile.lastIndexOf('.'); - - let fileName = srcFile.substring(0, dotIndex); - if (dotIndex == -1) - fileName = srcFile; - + const fileName = srcFile.replace(/\./g, ''); const file = `${fileName}.png`; const filePath = path.join(tempPath, file);