1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 22:25:08 +00:00

LibGfx: Make Bitmap path handling case insensitive

Bitmap::is_path_a_supported_image_format() and Bitmap::load_from_file()
now check the file extension with CaseSensitivity::CaseInsensitive.

This fixes a couple of inconsistencies, for example would
FileSystemModel::icon_for() recognize image files uppercase extensions
but couldn't create thumbnails for them (any attempt to create a bitmap
from such files would fail).
This commit is contained in:
Linus Groh 2020-11-13 00:25:27 +00:00 committed by Andreas Kling
parent d3ee3fc68a
commit 5b68ea8dde
3 changed files with 5 additions and 5 deletions

View file

@ -122,8 +122,8 @@ RefPtr<Bitmap> Bitmap::create_wrapper(BitmapFormat format, const IntSize& size,
RefPtr<Bitmap> Bitmap::load_from_file(const StringView& path)
{
#define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \
if (path.ends_with(Ext)) \
#define __ENUMERATE_IMAGE_FORMAT(Name, Ext) \
if (path.ends_with(Ext, CaseSensitivity::CaseInsensitive)) \
return load_##Name(path);
ENUMERATE_IMAGE_FORMATS
#undef __ENUMERATE_IMAGE_FORMAT