]> BookStack Code Mirror - bookstack/commitdiff
Wraps file extension comparison components in strtolower()
authorDanielGordonIT <redacted>
Wed, 3 Jul 2024 19:50:25 +0000 (15:50 -0400)
committerGitHub <redacted>
Wed, 3 Jul 2024 19:50:25 +0000 (15:50 -0400)
This avoids the issue where replacing file.PNG with newfile.png fails due to "PNG" not being equal to "png"

app/Uploads/ImageRepo.php

index 1e58816a4f3fc0b2da387896f78e558d1be87fde..845067fdc29987e318633a079c11f98ef3d6deef 100644 (file)
@@ -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'));
         }
 
Morty Proxy This is a proxified and sanitized view of the page, visit original site.