From 4f4cd0658282da370d5d19fb664422df01a5740c Mon Sep 17 00:00:00 2001 From: amit sharma Date: Fri, 9 Oct 2026 19:18:51 +0530 Subject: [PATCH] Fixed: 404 icon displayed on some module cards on the Module Catalog page Co-authored-by: Name --- classes/module/Module.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/classes/module/Module.php b/classes/module/Module.php index 69ea19b9a..b19b09d27 100644 --- a/classes/module/Module.php +++ b/classes/module/Module.php @@ -1663,15 +1663,16 @@ abstract class ModuleCore if (!in_array($modaddons->name, $modulesOnDisk)) { if (isset($modaddons->img)) { - if (!file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) { - if (!file_put_contents(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg', Tools::file_get_contents($modaddons->img))) { - copy(_PS_IMG_DIR_.'404.gif', _PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg'); + $imgFile = md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg'; + if (!file_exists(_PS_TMP_IMG_DIR_.$imgFile)) { + $imgContent = Tools::file_get_contents($modaddons->img); + if ($imgContent) { + file_put_contents(_PS_TMP_IMG_DIR_.$imgFile, $imgContent); } } - if (file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) { - $item->image = '../img/tmp/'.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg'; - } + // Show 404 image without caching it, so the download is retried next time + $item->image = file_exists(_PS_TMP_IMG_DIR_.$imgFile) ? '../img/tmp/'.$imgFile : '../img/404.gif'; } }