From 032148ccf8dc97b3155f348d0d98cc50500c3f75 Mon Sep 17 00:00:00 2001 From: Dorian Niemiec Date: Fri, 27 Dec 2024 15:56:14 +0100 Subject: [PATCH] fix: prevent creating empty cover image extensions when editing a mod --- includes/page_editmod.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/page_editmod.php b/includes/page_editmod.php index 4941509..9f9db51 100644 --- a/includes/page_editmod.php +++ b/includes/page_editmod.php @@ -75,7 +75,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { } } } else { - $fileExtension = str_replace(['/', '\\'], '', $modDataToEdit['image_ext']); + $fileExtension = $modDataToEdit['image_ext'] ? str_replace(['/', '\\'], '', $modDataToEdit['image_ext']) : null; $liveCoverImagePathname = $modUploadDirectory . '/' . str_replace(['/', '\\'], '', $modDataToEdit['slug']) . '.' . $fileExtension; if (file_exists($liveCoverImagePathname)) { if (!file_exists($modPendingUploadDirectory) && !mkdir($modPendingUploadDirectory, 0777, true)) {