fix: prevent creating empty cover image extensions when editing a mod

This commit is contained in:
Dorian Niemiec 2024-12-27 15:56:14 +01:00
parent bfc78bbc37
commit 032148ccf8

View file

@ -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)) {