From fb6950234756bbc8af86cb1b3c8498c452172f3c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 26 Apr 2022 23:37:47 +0200 Subject: [PATCH] MIME: use "jpg" as extension for image/jpeg even with newer MIME data Seems newer MIME data returns "jfif", which no one really uses. --- src/common/mime.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/mime.cpp b/src/common/mime.cpp index 7a99c6b4b..37365d3dc 100644 --- a/src/common/mime.cpp +++ b/src/common/mime.cpp @@ -60,8 +60,10 @@ primary_file_extension_for_type(std::string const &type_name) { auto q_type_name = Q(type_name).toLower(); for (auto const &type : all_types) - if (type.name() == q_type_name) - return to_utf8(type.preferredSuffix()); + if (type.name() == q_type_name) { + auto extension = to_utf8(type.preferredSuffix()); + return extension == "jfif" ? "jpg"s : extension; + } return {}; }