From 215e0c9fc4adc473d28416e282d53bd5a153c799 Mon Sep 17 00:00:00 2001 From: joan Date: Wed, 3 Feb 2021 15:01:09 +0100 Subject: [PATCH] Image download fix for images without extension --- .../item/back/methods/item-image-queue/downloadImages.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/item/back/methods/item-image-queue/downloadImages.js b/modules/item/back/methods/item-image-queue/downloadImages.js index b8a03e1c1..bee5492bc 100644 --- a/modules/item/back/methods/item-image-queue/downloadImages.js +++ b/modules/item/back/methods/item-image-queue/downloadImages.js @@ -48,7 +48,11 @@ module.exports = Self => { const srcFile = image.url.split('/').pop(); const dotIndex = srcFile.lastIndexOf('.'); - const fileName = srcFile.substring(0, dotIndex); + + let fileName = srcFile.substring(0, dotIndex); + if (dotIndex == -1) + fileName = srcFile; + const file = `${fileName}.png`; const filePath = path.join(tempPath, file);