See the attached test message which is modelled after a message I received today. My kMail is configured to compose plain text messages. If I reply to this message, the last attachment (a PDF tagged as "application/octet-stream") is taken as the body text and quoted in the composer. For the original message, this attachment was 9 MB in size, freezing kMail for quite some time until the composer opened with lots of garbage (binary PDF stuff) inside. Expected behaviour: The text body should be converted to plain text and used as the reply template, not the binary PDF attachment. Reproducible: Always
Created attachment 101055 [details] Demo message, if you reply to this message, the wrong MIME part is selected as the body text.
Addendum: This bug makes it hard to even reply to such mails. A workaround is to select the text part before hitting reply, kMail will then correctly quote and insert the selected text into composer. If you do not know (or do not remember) this feature, you'll be stuck and kMail might be as well, if the misused attachment is only big enough... ;)
This happens with several mails I received and is pretty annoying... First you hit reply, then kMail freezes eating 100% CPU and you just think "Oh no, not again...", then the editor opens showing you a "quoted PDF" and you have to close the editor, select the text you want to reply to and hit "reply" again - hmpf... Copy pasted from my Composer window: Am Dienstag, 20. September 2016, 20:59:20 CEST schrieben Sie: > %PDF-1.5 > %µµµµ > 1 0 obj > <</Type/Catalog/Pages 2 0 R/Lang(de-DE) /StructTreeRoot 25 0 > R/MarkInfo<</Marked true>>>> endobj > 2 0 obj > <</Type/Pages/Count 2/Kids[ 3 0 R 20 0 R] >> > endobj > 3 0 obj > <</Type/Page/Parent 2 0 R/Resources<</ExtGState<</GS5 5 0 R/GS8 8 0 > R>>/Font<</F1 6 0 R/F2 11 0 R/F3 13 0 R/F4 15 0 R>>/XObject<</Image10 10 0 > R>>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 9 0 R] /MediaBox[ 0 > 0 595.32 841.92] /Contents 4 0 > R/Group<</Type/Group/S/Transparency/CS/DeviceRGB>>/Tabs/S/StructParents (...)
same behaviour here. i've also found this workaround: changing the standard templates by removing %QUOTE and adding both %TEXT and %FORCEDHTML show the original message(s) correctly but without quote.
i think i have a similar issue with kmail 5.1.3, it only happens regularly with encrypted mails that came over a mailman list and have an unecrypted part appended (listinfo): when i hit "reply", only this last part -- the listinfo section -- is being used as reply text. if the mail is encrypted as usual (no unencrypted parts), then kmail uses the unencrypted mail content for the reply. i can work around the issue by selecting the actual text before "reply".
I confirm it
it's a bug in mimetreeparser: We use: void TemplateParser::processWithTemplate(const QString &tmpl) { mOtp->parseObjectTree(mOrigMsg.data()); => void ObjectTreeParser::parseObjectTree(KMime::Content *node) { mTopLevelContent = node; mParsedPart = parseObjectTreeInternal(node, showOnlyOneMimePart()); if (mParsedPart) { mParsedPart->fix(); mParsedPart->copyContentFrom(); if (auto mp = toplevelTextNode(mParsedPart)) { if (auto _mp = mp.dynamicCast<TextMessagePart>()) { extractNodeInfos(_mp->mNode, true); } else if (auto _mp = mp.dynamicCast<AlternativeMessagePart>()) { if (_mp->mChildNodes.contains(Util::MultipartPlain)) { extractNodeInfos(_mp->mChildNodes[Util::MultipartPlain], true); } } setPlainTextContent(mp->text()); } => mp->text() seems to be not correct. I CC Sandro Knauß who needs better this code. Regards
This is the same problem as https://bugs.kde.org/show_bug.cgi?id=368060. I've put a code hacky fix for this on that ticket.
The base problem is that a html mail with attachments, so lets merge *** This bug has been marked as a duplicate of bug 368060 ***