Skip to content

NOW MANAGED ON CODEBERG

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"

DanielGordonIT9b0ef85f77f1
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'));
}