1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-10-30 07:32:39 +01:00

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"
This commit is contained in:
DanielGordonIT 2024-07-03 15:50:25 -04:00 committed by GitHub
parent 14837e34fb
commit 9b0ef85f77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -166,7 +166,7 @@ class ImageRepo
*/ */
public function updateImageFile(Image $image, UploadedFile $file): void 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')); throw new ImageUploadException(trans('errors.image_upload_replace_type'));
} }