Vincent Vanlear is right that quoted-printable (QP) should be decoded before format=flowed. The debug output that Klaus B. posted above suggests that QP is decoded before format=flowed runs on it, so it seems that is working as expected. That would imply that this is not what is causing the bug here. Vincent, if you have more specific comments on what is going wrong where exactly in the code, please feel free to post it. > the leading space removal happens in MimeMessage_parse_line() before we QP-decode [and before format=flowed] That seems wrong, and it seems to be the root cause here. I digged and it seems this was introduced in bug 1287126 and then again modified here. But it seems that was the wrong place to fix the space stuffing, it should have been in the flowed class all along, and we're just fixing one bug after the other. I think the right fix would be to remove this code from this class completely and put it into the flowed class. The correct fix would need to consider both bug 1287126 (but choose a different implementation to fix that bug) and this bug here. > the MIME code goes back more than 20 years True, but the bug here goes back only 5 years, and the cause is that it was fixed in a way that is not correct. It's also not a fundamental change, but merely moving these few code lines, and instead of moving them up, to move them into the flowed class instead. So, no worries, you're not rocking the MIME castle :). Sorry for coming late into the game after this bug was already fixed, reviewed, landed, and backported. I don't want to say that this was all wrong. I'm just posting my observations here.
Bug 1689804 Comment 79 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Vincent Vanlear is right that quoted-printable (QP) should be decoded before format=flowed. The debug output that Klaus B. posted above suggests that QP is decoded before format=flowed runs on it, so it seems that is working as expected. That would imply that this is not what is causing the bug here. Vincent, if you have more specific comments on what is going wrong where exactly in the code, please feel free to post it. > the leading space removal happens in MimeMessage_parse_line() before we QP-decode [and before format=flowed] That seems to be the wrong place to do it, and it seems to be the root cause here. I digged and it seems this was introduced in bug 1287126 and then again modified here. But it seems that was the wrong place to fix the space stuffing, it should have been in the flowed class all along, and we're just fixing one bug after the other. I think the right fix would be to remove this code from this class completely and put it into the flowed class. The correct fix would need to consider both bug 1287126 (but choose a different implementation to fix that bug) and this bug here. > the MIME code goes back more than 20 years True, but the bug here goes back only 5 years, and the cause is that it was fixed in a way that is not correct. It's also not a fundamental change, but merely moving these few code lines, and instead of moving them up, to move them into the flowed class instead. So, no worries, you're not rocking the MIME castle :). Sorry for coming late into the game after this bug was already fixed, reviewed, landed, and backported. I don't want to say that this was all wrong. I'm just posting my observations here.
Vincent Vanlear is right that quoted-printable (QP) should be decoded before format=flowed. The debug output that Klaus B. posted above suggests that QP is decoded before format=flowed runs on it, so it seems that is working as expected. That would imply that this is not what is causing the bug here. Vincent, if you have more specific comments on what is going wrong where exactly in the code, please feel free to post it. > the leading space removal happens in MimeMessage_parse_line() before we QP-decode [and before format=flowed] That seems to be the wrong place to do it, and it seems to be the root cause here. I digged and it seems this was introduced in bug 1287126 and then again modified here. I think the right fix would be to remove this code from this class completely and put it into the flowed class. The fix would need to consider both bug 1287126 (but choose a different implementation to fix that bug) and this bug here. > the MIME code goes back more than 20 years True, but the bug here goes back only 5 years, and the cause is that it was fixed in a way that is not correct. It's also merely moving these few code lines, and instead of moving them up, to move them into the flowed class instead. So, no worries, you're not rocking the MIME castle :). Sorry for coming late into the game after this bug was already fixed, reviewed, landed, and backported. I don't want to say that this was all wrong. I'm just posting my observations here, in response to Vincent.