Do not clear parameters when changing the mimetype of a Content-Type header
ClosedPublic

Authored by vkrause on Oct 31 2017, 11:33 AM.

Details

Summary

As there is no API to retrieve and restore all parameters, it is otherwise
impossible to change the mimetype while preserving all other parameters.
This is needed for example when fixing wrong mimetype information for
display in KMail (see D8551).

Test Plan

Unit test of messagelib (which is the primary consumer of this API) still
pass too.

Diff Detail

Repository
R180 PIM: KMime
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
vkrause created this revision.Oct 31 2017, 11:33 AM
Restricted Application added a project: KDE PIM. · View Herald TranscriptOct 31 2017, 11:33 AM
knauss added a subscriber: knauss.Oct 31 2017, 12:18 PM

that is a behaviour change - did you check what parts use this code and may rely on the cleaning? The other solution would fix magicSetType to store all paramenters before and reset afterwards.

that is a behaviour change - did you check what parts use this code and may rely on the cleaning? The other solution would fix magicSetType to store all paramenters before and reset afterwards.

I did not find a user relying on this, but it's possible I missed some subtle details of course. It's certainly a surprising behavior, and I could not find any explanation in the history on why this was there.

As noted in the commit message, there is no API to iterate the parameters, or retrieve all of them, so the proposed workaround in magicSetType would also require API changes in KMime first.

knauss accepted this revision as: knauss.Oct 31 2017, 6:59 PM

okay, than let's test this :)

This revision is now accepted and ready to land.Oct 31 2017, 6:59 PM
This revision was automatically updated to reflect the committed changes.