Skip to content

Fix for unfold_header() when a line break was made at a comma

John D. Rowell requested to merge jdrowell/mutt:unfold_header into master

While working on a display_filter that extracts fields from a header generated by SpamAssassin, a few cases showed up where the extraction didn't work properly. The header is UnIgnored, so it goes through unfolding before being passed to display_filter for the pager. The problem is that the unfolding adds a spaces to join the lines, which is appropriate in most cases. But if the previous line terminated in a comma, it can be assumed that it was a very long line that needed to be broken up, and the best place was at a comma (and not mid-word). Here's an example header that would be improperly unfolded:

[2024-06-19 17:57:53] mwoh: pfx=[], tag=[X-Spam-Status], flags=262294 value=[No, score=-0.5 required=5.0 tests=BAYES_50,HTML_MESSAGE,MISSING_HEADERS,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RC
VD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=4.0.0
]

I added a couple of new tests for the case of the comma, and it seems to work nicely.

Merge request reports