Fix CryptoUtils::assembleMessage() to not add bogus text/plain content-type

Found by failing unit tests mailcommon-filter-filteractiondecrypttest &
mailcommon-filter-filteractionencrypttest
wilder-portage
Friedrich W. H. Kossebau 5 years ago
parent 181068766c
commit 17197c848c
  1. 10
      src/util/cryptoutils.cpp

@ -166,9 +166,17 @@ KMime::Message::Ptr CryptoUtils::assembleMessage(const KMime::Message::Ptr &orig
out->setBody(const_cast<KMime::Content *>(newContent)->encodedBody());
out->parse();
// remove default explicit content headers added by KMime::Content::parse()
QVector<KMime::Headers::Base *> headers = out->headers();
for (const auto hdr : std::as_const(headers)) {
if (isContentHeader(hdr)) {
out->removeHeader(hdr->type());
}
}
// Copy over headers from the original message, except for CT, CTE and CD
// headers, we want to preserve those from the new content
QVector<KMime::Headers::Base *> headers = orig->headers();
headers = orig->headers();
for (const auto hdr : std::as_const(headers)) {
if (isContentHeader(hdr)) {
continue;

Loading…
Cancel
Save