BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.47k stars 1.94k forks source link

Wraps file extension comparison components in strtolower() #5096

Closed DanielGordonIT closed 4 months ago

DanielGordonIT commented 4 months ago

Created to fix #5095 This avoids the issue where replacing file.PNG with newfile.png fails due to "PNG" not being equal to "png"

ssddanbrown commented 4 months ago

Thanks @DanielGordonIT for providing this!

If you're confident with such a codebase, it would also be good to have a test to cover this scenario. We have some test guidance here. Here's an existing test related to this scenario, so an added test would be similar:

https://github.com/BookStackApp/BookStack/blob/14837e34fb7524b8ace87a49c8b808542addd55d/tests/Uploads/ImageTest.php#L122-L139

If you're not able to add this, that's fine, just let me know and I can write the test during review.

DanielGordonIT commented 4 months ago

I will work on creating a test for this tonight! If I am not able to make the test (PHP is not a language I am very familiar with, not that it's stopped me from using the theme system), I will let you know.

DanielGordonIT commented 4 months ago

@ssddanbrown I've added what I think would be a functional test case, but please do give it a review.

Wait no I did not the commit didn't work

ssddanbrown commented 4 months ago

This all looks good @DanielGordonIT, Thank you very much again for providing this and for putting in the extra effort to write a test! Merging for next patch release.