Skip to content

Commit 3275bdc

Browse files
committed
try harder to decode WEBP in groups
1 parent ddb0202 commit 3275bdc

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/chatlog/chatwidget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ void renderMessageRaw(const QString& pubkey, const QString& displayName, bool is
125125
QByteArray image_data_bytes = QByteArray::fromHex(chatLogMessage.message.id_or_hash.toLatin1());
126126
QPixmap pixmap_;
127127
bool result = pixmap_.loadFromData(image_data_bytes);
128+
if (!result)
129+
{
130+
qDebug() << "renderMessageRaw:loadFromData:trying with hardcoded WEBP type";
131+
result = pixmap_.loadFromData(image_data_bytes, "WEBP");
132+
}
128133
qDebug() << "renderMessageRaw:loadFromData:res=" << result;
129134

130135
if (result)

src/widget/widget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,6 +2091,11 @@ void Widget::onGroupMessageReceivedImage(int groupnumber, int peernumber, const
20912091

20922092
QPixmap mpixmap;
20932093
bool result = mpixmap.loadFromData(image_data_bytes);
2094+
if (!result)
2095+
{
2096+
qDebug() << "onGroupMessageReceivedImage:loadFromData:trying with hardcoded WEBP type";
2097+
result = mpixmap.loadFromData(image_data_bytes, "WEBP");
2098+
}
20942099
qDebug() << "onGroupMessageReceivedImage:loadFromData:res=" << result;
20952100

20962101
//if (result)

0 commit comments

Comments
 (0)