diff --git a/src/messagesadapter.cpp b/src/messagesadapter.cpp
index 8e8d71f6e10f265c0792f20322a3aa8d5c8adf20..0a80cc02dd365b63c303a36d26b76ca8c8801b0a 100644
--- a/src/messagesadapter.cpp
+++ b/src/messagesadapter.cpp
@@ -361,9 +361,14 @@ MessagesAdapter::setNewMessagesContent(const QString& path)
 {
     if (path.length() == 0)
         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);
     } else {
         setMessagesFileContent(path);