From 347ac77878312a3c93b9ed45f13228baa280d3db Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 24 Feb 2021 09:59:41 +0100 Subject: [PATCH] Changes to file names --- back/models/image.js | 4 ++-- .../item/back/methods/item-image-queue/downloadImages.js | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) 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);