Probe attachment mimetypes ourselves when there's doubt
ClosedPublic

Authored by vkrause on Oct 30 2017, 10:35 AM.

Details

Summary

When encountering attachments without a proper mimetype, let's see if we
can find something better. This helps for example with airline booking
confirmation emails with iCal attachments, many have those but all samples
I have mark them as application/octet-stream, making them inaccessible for
KMail.

Now we give the corresponding plugins a chance to process these cases too.

Diff Detail

Repository
R94 PIM: Message Library
Branch
top
Lint
No Linters Available
Unit
No Unit Test Coverage
vkrause created this revision.Oct 30 2017, 10:35 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptOct 30 2017, 10:35 AM
Restricted Application added a subscriber: KDE PIM. · View Herald Transcript
knauss added a subscriber: knauss.Oct 30 2017, 12:36 PM
knauss added inline comments.
mimetreeparser/src/objecttreeparser.cpp
197 ↗(On Diff #21555)

getting rid of "bool onlyOneMimePart" is seperated patch (simple cleanup)

270 ↗(On Diff #21555)

Do we really need to write the the content to file before getting the propper mimetype? isn't that possible with QTextStream?

knauss added inline comments.Oct 30 2017, 2:48 PM
mimetreeparser/src/objecttreeparser.cpp
270 ↗(On Diff #21555)

maybe you want use NodeHelper::magicSetType / maybe without modifiing the contentType... This method is called later on from AttachmentMessagePartRenderer::render ...

vkrause added inline comments.Oct 31 2017, 11:11 AM
mimetreeparser/src/objecttreeparser.cpp
270 ↗(On Diff #21555)

Yep, that works much better, with a lot less code changes required, plugins just work out of the box :)

There's just one little issue in KMime breaking some stuff as a result of this change, as changing the content type will currently lose all other parameters in the Content-Type header.

vkrause updated this revision to Diff 21621.Oct 31 2017, 11:35 AM

Persist the probed mimetype, which simplifies things considerably.
Needs D8568 to work correctly in all cases.

knauss accepted this revision.Oct 31 2017, 12:17 PM
This revision is now accepted and ready to land.Oct 31 2017, 12:17 PM
This revision was automatically updated to reflect the committed changes.