This fixes display issues with files that consist of CRLF
line endings rather than just LF line endings, for example,
emails exported directly from the gmail API.
This only kicks in when CH_DECODE is set which might be a bit
strange, because that does RFC2047 header decoding, but it seems
a safe place to place this line end decoding without potentially
affecting anything else.
if (!address_header_decode(&this_one))
rfc2047_decode(&this_one);
this_one_len = mutt_strlen(this_one);
+
+ /* Convert CRLF line endings to LF */
+ if ((this_one_len > 2) && (this_one[this_one_len - 2] == '\r') &&
+ (this_one[this_one_len - 1] == '\n'))
+ {
+ this_one[this_one_len - 2] = '\n';
+ this_one[this_one_len - 1] = 0;
+ }
}
if (!headers[x])