Improve trailing spurious breaks + tests

This commit is contained in:
Michael Telatynski 2020-01-22 13:37:27 +00:00
parent 9a530a72f6
commit 832da062cc
3 changed files with 63 additions and 22 deletions

View file

@ -250,7 +250,7 @@ function parseHtmlMessage(html, partCreator, isQuotedMessage) {
}
export function parsePlainTextMessage(body, partCreator, isQuotedMessage) {
const lines = body.split(/\r\n|\r|\n/g); // split on any new-line combination not just \n
const lines = body.split(/\r\n|\r|\n/g); // split on any new-line combination not just \n, collapses \r\n
const parts = lines.reduce((parts, line, i) => {
if (isQuotedMessage) {
parts.push(partCreator.plain(QUOTE_LINE_PREFIX));