1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-31 12:13:36 +02:00

messagesadapter: use decideFormatFromContent for QImageReader

Change-Id: Ib225b2fbc739f10802fd5951bf9c04b5767da024
This commit is contained in:
Ming Rui Zhang 2021-06-11 11:16:10 -04:00
parent dc060370f4
commit c4ad576985

View file

@ -361,9 +361,14 @@ MessagesAdapter::setNewMessagesContent(const QString& path)
{ {
if (path.length() == 0) if (path.length() == 0)
return; return;
QByteArray imageFormat = QImageReader::imageFormat(path);
if (!imageFormat.isEmpty()) { // QImageReader will treat .gz file (Jami archive) as svgz image format
// so decideFormatFromContent is needed
QImageReader reader;
reader.setDecideFormatFromContent(true);
reader.setFileName(path);
if (!reader.read().isNull()) {
setMessagesImageContent(path); setMessagesImageContent(path);
} else { } else {
setMessagesFileContent(path); setMessagesFileContent(path);