You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MailFinder.email_text_body deduplicates multiple \n newlines before it converts \r\n linebreaks to \n. That way, newlines in bodies with only \r\n linebreaks are actually never deduplicated.
body.gsub("\r\n","\n")# The mail gem (>= 2.7.1) switched from \n to \r\n line breaks (LF to CRLF) in plain text mails.
end
While we could just move gsub(/\n\n/, "\n") from the html_part section to the end of email_text_body and always deduplicate, this would impact plain-text bodies negatively.
Maybe use gsub(/\r?\n\r?\n/, "\n") in the html_part section instead. Or gsub(/\r?\n(?:\r?\n)/, "\n"), maybe?
Please also provide a 2.99.x backport for this to allow easier migration to 3.0.
The text was updated successfully, but these errors were encountered:
foobear
changed the title
HTML text representation includes too many linebreaks
HTML email' text representation includes too many linebreaks
Oct 15, 2020
foobear
changed the title
HTML email' text representation includes too many linebreaks
HTML email's text representation includes too many linebreaks
Oct 15, 2020
MailFinder.email_text_body
deduplicates multiple\n
newlines before it converts\r\n
linebreaks to\n
. That way, newlines in bodies with only\r\n
linebreaks are actually never deduplicated.For example,
"<p>\r\nHello!\r\n</p>\r\n<p>\r\nBye!\r\n</p>"
results in
"Hello!\n\n\nBye!"
Relevant code:
spreewald/lib/spreewald_support/mail_finder.rb
Lines 60 to 70 in db95ff3
While we could just move
gsub(/\n\n/, "\n")
from thehtml_part
section to the end ofemail_text_body
and always deduplicate, this would impact plain-text bodies negatively.Maybe use
gsub(/\r?\n\r?\n/, "\n")
in thehtml_part
section instead. Orgsub(/\r?\n(?:\r?\n)/, "\n")
, maybe?Please also provide a 2.99.x backport for this to allow easier migration to 3.0.
The text was updated successfully, but these errors were encountered: