From 0b78fa9819610e208a6633b4a7f779d6e91711c5 Mon Sep 17 00:00:00 2001 From: Codencode Date: Mon, 25 Nov 2024 16:56:26 +0100 Subject: [PATCH] Update ps_imageslider.php Converted the file name using `Tools::str2url()` --- ps_imageslider.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ps_imageslider.php b/ps_imageslider.php index 832cc01..72a71ed 100644 --- a/ps_imageslider.php +++ b/ps_imageslider.php @@ -514,17 +514,18 @@ protected function _postProcess() ) { $temp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS'); $salt = sha1(microtime()); + $file_name = Tools::str2url($_FILES['image_' . $language['id_lang']]['name']) . $type; if ($error = ImageManager::validateUpload($_FILES['image_' . $language['id_lang']])) { $errors[] = $error; } elseif (!$temp_name || !move_uploaded_file($_FILES['image_' . $language['id_lang']]['tmp_name'], $temp_name)) { return false; - } elseif (!ImageManager::resize($temp_name, __DIR__ . '/images/' . $salt . '_' . $_FILES['image_' . $language['id_lang']]['name'], null, null, $type)) { + } elseif (!ImageManager::resize($temp_name, __DIR__ . '/images/' . $salt . '_' . $file_name, null, null, $type)) { $errors[] = $this->displayError($this->trans('An error occurred during the image upload process.', [], 'Admin.Notifications.Error')); } if (file_exists($temp_name)) { @unlink($temp_name); } - $slide->image[$language['id_lang']] = $salt . '_' . $_FILES['image_' . $language['id_lang']]['name']; + $slide->image[$language['id_lang']] = $salt . '_' . $file_name; } elseif (Tools::getValue('image_old_' . $language['id_lang']) != '') { $slide->image[$language['id_lang']] = Tools::getValue('image_old_' . $language['id_lang']); }