mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2025-12-16 23:14:57 +08:00
MessageAdapter: check MIME types
QImageReader would previously improperly reject images if their MIME type was not an exact match for the string of its supported types. We should check against the supported MIME types instead. GitLab: #2138 Change-Id: Id1116e930dcd120d7ec2262a1eb7504d59a675eb
This commit is contained in:
@@ -563,13 +563,13 @@ MessagesAdapter::isLocalImage(const QString& mimename)
|
||||
{
|
||||
if (mimename.startsWith("image/")) {
|
||||
QString fileFormat = mimename;
|
||||
fileFormat.replace("image/", "");
|
||||
|
||||
QImageReader reader;
|
||||
QList<QByteArray> supportedFormats = reader.supportedImageFormats();
|
||||
QList<QByteArray> supportedFormats = reader.supportedMimeTypes();
|
||||
auto iterator = std::find_if(supportedFormats.begin(),
|
||||
supportedFormats.end(),
|
||||
[fileFormat](const QByteArray& format) { return format == fileFormat; });
|
||||
if (iterator != supportedFormats.end() && *iterator == "gif") {
|
||||
if (iterator != supportedFormats.end() && *iterator == "image/gif") {
|
||||
return {{"isAnimatedImage", true}};
|
||||
}
|
||||
return {{"isImage", iterator != supportedFormats.end()}};
|
||||
|
||||
Reference in New Issue
Block a user