From: DanielGordonIT Date: Wed, 3 Jul 2024 19:50:25 +0000 (-0400) Subject: Wraps file extension comparison components in strtolower() X-Git-Tag: v24.05.3~1^2~6^2~2 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/9b0ef85f77f140be8dffa2f333070f0429c15bb2 Wraps file extension comparison components in strtolower() This avoids the issue where replacing file.PNG with newfile.png fails due to "PNG" not being equal to "png" --- diff --git a/app/Uploads/ImageRepo.php b/app/Uploads/ImageRepo.php index 1e58816a4..845067fdc 100644 --- a/app/Uploads/ImageRepo.php +++ b/app/Uploads/ImageRepo.php @@ -166,7 +166,7 @@ class ImageRepo */ public function updateImageFile(Image $image, UploadedFile $file): void { - if ($file->getClientOriginalExtension() !== pathinfo($image->path, PATHINFO_EXTENSION)) { + if (strtolower($file->getClientOriginalExtension()) !== strtolower(pathinfo($image->path, PATHINFO_EXTENSION))) { throw new ImageUploadException(trans('errors.image_upload_replace_type')); }