Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge branch 'tspecials' into 'master'
[messagingframework] Add missing slash character as protected in header parameters. Contributes to JB#51533 See merge request mer-core/messagingframework!48
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
rpm/0025-Add-missing-slash-character-as-protected-in-header-p.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
From a5191e0ebbbbf6b8f3636394f24499bd34f3fba6 Mon Sep 17 00:00:00 2001 | ||
From: Damien Caliste <dcaliste@free.fr> | ||
Date: Wed, 2 Sep 2020 16:58:12 +0200 | ||
Subject: [PATCH] Add missing slash character as protected in header parameters | ||
|
||
For some reason the '/' character that is defined as a protected | ||
character in RFC2045 for values of parameters in header | ||
Content-Type field, was missing. As a result the protocol | ||
parameter for multipart/signed emails was not escaped which | ||
is faulty and was confusing some email clients. | ||
|
||
Change-Id: Id9d43b883187317ec152eea56819822612bfe307 | ||
--- | ||
src/libraries/qmfclient/qmailmessage.cpp | 3 ++- | ||
tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp | 8 ++++++++ | ||
2 files changed, 10 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp | ||
index 71491f1a..38d1eee3 100644 | ||
--- a/src/libraries/qmfclient/qmailmessage.cpp | ||
+++ b/src/libraries/qmfclient/qmailmessage.cpp | ||
@@ -1956,7 +1956,8 @@ void QMailMessageHeaderFieldPrivate::setParameterEncoded(const QByteArray& name) | ||
static QByteArray protectedParameter(const QByteArray& value) | ||
{ | ||
QRegExp whitespace(QLatin1String("\\s+")); | ||
- QRegExp tspecials = QRegExp(QLatin1String("[<>\\[\\]\\(\\)\\?:;@\\\\,=]")); | ||
+ // See list in RFC2045: https://tools.ietf.org/html/rfc2045#page-12 | ||
+ QRegExp tspecials = QRegExp(QLatin1String("[<>\\[\\]\\(\\)\\?:;@\\\\,=/]")); | ||
|
||
if ((whitespace.indexIn(value) != -1) || | ||
(tspecials.indexIn(value) != -1)) | ||
diff --git a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp | ||
index 34d8ae63..7f3f0eef 100644 | ||
--- a/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp | ||
+++ b/tests/tst_qmailmessageheader/tst_qmailmessageheader.cpp | ||
@@ -574,6 +574,14 @@ void tst_QMailMessageHeaderField::setParameter() | ||
QVERIFY( header2.isParameterEncoded(name) == false ); | ||
QCOMPARE( header3.parameter(name), oversize ); | ||
QVERIFY( header3.isParameterEncoded(name) == false ); | ||
+ | ||
+ QMailMessageHeaderField header4("Content-Type: multipart/signed"); | ||
+ name = "protocol"; | ||
+ parameter = "application/pgp-signature"; | ||
+ | ||
+ header4.setParameter(name, parameter); | ||
+ QCOMPARE( header4.toString(), QByteArray("Content-Type: multipart/signed;" | ||
+ " protocol=\"application/pgp-signature\"") ); | ||
} | ||
|
||
void tst_QMailMessageHeaderField::isParameterEncoded() | ||
-- | ||
2.26.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters