From d73422f612944bf9e82a9d82ce10bcffd57e3da6 Mon Sep 17 00:00:00 2001
From: Ming Rui Zhang <mingrui.zhang@savoirfairelinux.com>
Date: Wed, 18 Nov 2020 11:58:09 -0500
Subject: [PATCH] messagesadapter: show clipboard image correctly in chatview

For example, with the fix, image copied from web or snipping tool
should show correctly in data_transfer_send_container of chatview

Change-Id: Ie86e7c2a5ef042ae43acd4a8f1d2ebc9641385e3
---
 src/messagesadapter.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/messagesadapter.cpp b/src/messagesadapter.cpp
index 948d4cf5c..fbb384916 100644
--- a/src/messagesadapter.cpp
+++ b/src/messagesadapter.cpp
@@ -393,7 +393,7 @@ MessagesAdapter::pasteKeyDetected()
         QBuffer bu(&ba);
         bu.open(QIODevice::WriteOnly);
         pixmap.save(&bu, "PNG");
-        auto str = QString::fromLocal8Bit(ba.toBase64());
+        auto str = QString::fromLatin1(ba.toBase64().data());
 
         setMessagesImageContent(str, true);
     } else if (mimeData->hasUrls()) {
@@ -590,7 +590,7 @@ void
 MessagesAdapter::setMessagesImageContent(const QString& path, bool isBased64)
 {
     if (isBased64) {
-        QString param = QString("addImage_base64('file://%1')").arg(path);
+        QString param = QString("addImage_base64('%1')").arg(path);
         QMetaObject::invokeMethod(qmlObj_, "webViewRunJavaScript", Q_ARG(QVariant, param));
     } else {
         QString param = QString("addImage_path('file://%1')").arg(path);
-- 
GitLab