diff --git a/Libraries/LibGUI/FilePicker.cpp b/Libraries/LibGUI/FilePicker.cpp index 674de7f28f..591699d4bb 100644 --- a/Libraries/LibGUI/FilePicker.cpp +++ b/Libraries/LibGUI/FilePicker.cpp @@ -269,7 +269,7 @@ FilePicker::~FilePicker() void FilePicker::set_preview(const LexicalPath& path) { - if (path.has_extension(".png")) { + if (Gfx::Bitmap::is_path_a_supported_image_format(path.string())) { auto bitmap = Gfx::Bitmap::load_from_file(path.string()); if (!bitmap) { clear_preview(); diff --git a/Libraries/LibGUI/FileSystemModel.cpp b/Libraries/LibGUI/FileSystemModel.cpp index 0b8603efbf..71ed505025 100644 --- a/Libraries/LibGUI/FileSystemModel.cpp +++ b/Libraries/LibGUI/FileSystemModel.cpp @@ -460,7 +460,7 @@ Icon FileSystemModel::icon_for_file(const mode_t mode, const String& name) const Icon FileSystemModel::icon_for(const Node& node) const { - if (node.name.to_lowercase().ends_with(".png") || node.name.to_lowercase().ends_with(".gif")) { + if (Gfx::Bitmap::is_path_a_supported_image_format(node.name.to_lowercase())) { if (!node.thumbnail) { if (!const_cast(this)->fetch_thumbnail_for(node)) return m_filetype_image_icon;