Commit 2ca2b7a9 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Merge remote-tracking branch 'origin/release/21.04'

parents fdfe5bd7 6c4fd41e
Pipeline #62026 passed with stage
in 39 minutes and 14 seconds
......@@ -728,3 +728,17 @@ void StringUtilTest::test_formatQuotePrefix()
QFETCH(QString, result);
QCOMPARE(MessageCore::StringUtil::formatQuotePrefix(quotePattern, from), result);
}
void StringUtilTest::test_parseMailToBug206269()
{
const QByteArray ba(QByteArrayLiteral("mailto:team@example.com?subject=A%26B&body=D%26C"));
QUrl urlDecoded(QUrl::fromPercentEncoding(ba));
QVector<QPair<QString, QString>> data = StringUtil::parseMailtoUrl(urlDecoded);
QCOMPARE(data.size(), 3);
QCOMPARE(data.at(0).first, QLatin1String("to"));
QCOMPARE(data.at(0).second, QLatin1String("team@example.com"));
QCOMPARE(data.at(1).first, QLatin1String("subject"));
QCOMPARE(data.at(1).second, QLatin1String("A&B"));
QCOMPARE(data.at(2).first, QLatin1String("body"));
QCOMPARE(data.at(2).second, QLatin1String("D&C"));
}
......@@ -33,5 +33,6 @@ private Q_SLOTS:
void test_parseMailToWithUtf8QuotedEncoded();
void test_crashXdgemail();
void test_xdgemail();
void test_parseMailToBug206269();
};
......@@ -187,11 +187,16 @@ QVector<QPair<QString, QString>> parseMailtoUrl(const QUrl &url)
toStr << queryItem.second;
indexTo = i;
} else {
QPair<QString, QString> pairElement;
pairElement.first = queryItem.first.toLower();
pairElement.second = queryItem.second;
values.append(pairElement);
i++;
if (queryItem.second.isEmpty()) {
// Bug 206269 => A%26B => encoded '&'
values[i - 1].second = values[i - 1].second + QStringLiteral("&") + queryItem.first;
} else {
QPair<QString, QString> pairElement;
pairElement.first = queryItem.first.toLower();
pairElement.second = queryItem.second;
values.append(pairElement);
i++;
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment