diff --git a/src/filter/autotests/gpghome/gpg.conf b/src/filter/autotests/gpghome/gpg.conf new file mode 100644 index 0000000..228993a --- /dev/null +++ b/src/filter/autotests/gpghome/gpg.conf @@ -0,0 +1,3 @@ +# TODO: replace test keys with some which do not expire +# so this special setup is not needed and the test can check normal operation +faked-system-time 20180110T154812 diff --git a/src/util/cryptoutils.cpp b/src/util/cryptoutils.cpp index e8169a7..9ee39f5 100644 --- a/src/util/cryptoutils.cpp +++ b/src/util/cryptoutils.cpp @@ -166,9 +166,17 @@ KMime::Message::Ptr CryptoUtils::assembleMessage(const KMime::Message::Ptr &orig out->setBody(const_cast(newContent)->encodedBody()); out->parse(); + // remove default explicit content headers added by KMime::Content::parse() + QVector 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 headers = orig->headers(); + headers = orig->headers(); for (const auto hdr : std::as_const(headers)) { if (isContentHeader(hdr)) { continue;