Skip to content

Commit

Permalink
[qmf] Use EightBit for text and email files. Contributes to JB#12571
Browse files Browse the repository at this point in the history
Previously attachments with text/* or message/rfc822 encoding were
base64 encoded for no good reason. Change them to use EightBit transfer
encoding.

This fixes forwarding .eml files that previously were totally broken.
Additionally it changes behaviour for text type files which no longer
need to be base64 encoded using 25% less data.
  • Loading branch information
Tomin1 committed Sep 30, 2019
1 parent 339c1fb commit 152e45b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
@@ -0,0 +1,37 @@
From 6648e72b7db42dac51468c5225d89b2691019572 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomi=20Lepp=C3=A4nen?= <tomi.leppanen@jolla.com>
Date: Mon, 30 Sep 2019 14:11:57 +0300
Subject: [PATCH] Use EightBit encoding instead of Base64 for text types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Previously attachments with text/* or message/rfc822 encoding were
base64 encoded for no good reason. Change them to use EightBit transfer
encoding.

Signed-off-by: Tomi Leppänen <tomi.leppanen@jolla.com>
---
src/libraries/qmfclient/qmailmessage.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp
index 71491f1a..d7678678 100644
--- a/src/libraries/qmfclient/qmailmessage.cpp
+++ b/src/libraries/qmfclient/qmailmessage.cpp
@@ -1579,7 +1579,11 @@ namespace attachments
disposition.setParameter("filename*", QMailMessageContentDisposition::encodeParameter(input, "UTF-8"));
}

- container->appendPart(QMailMessagePart::fromFile(filePath, disposition,attach_type, QMailMessageBody::Base64,
+ QMailMessageBody::TransferEncoding te(QMailMessageBody::Base64);
+ if (attach_type.matches("text") || attach_type.matches("message", "rfc822"))
+ te = QMailMessageBody::EightBit;
+
+ container->appendPart(QMailMessagePart::fromFile(filePath, disposition, attach_type, te,
QMailMessageBody::RequiresEncoding));
addedSome = true;
}
--
2.21.0

2 changes: 2 additions & 0 deletions rpm/qmf-qt5.spec
Expand Up @@ -46,6 +46,7 @@ Patch15: 0015-Check-if-IDLE-connection-needs-to-be-established-aft.patch
Patch16: 0016-Revert-Fix-bundled-zlib-detection.patch
Patch17: 0017-Add-signature-settings-in-account.patch
Patch18: 0018-Use-socket-s-local-address-for-HELO-and-EHLO-message.patch
Patch19: 0019-Use-EightBit-encoding-instead-of-Base64-for-text-typ.patch

%description
The Qt Messaging Framework, QMF, consists of a C++ library and daemon server
Expand Down Expand Up @@ -169,6 +170,7 @@ This package contains the tests for Qt Messaging Framework (QMF).
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1

%build

Expand Down

0 comments on commit 152e45b

Please sign in to comment.