From: Vsevolod Stakhov Date: Thu, 10 Sep 2015 12:47:28 +0000 (+0100) Subject: Be more carefull about newlines in html. X-Git-Tag: 1.0.0~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0affe52da0ca281a482f8dfeb0868529425f0377;p=thirdparty%2Frspamd.git Be more carefull about newlines in html. --- diff --git a/src/libserver/html.c b/src/libserver/html.c index 401c13f7a8..96380a3ef6 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1887,10 +1887,14 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, setbit (hc->tags_seen, cur_tag->id); } - if ((cur_tag->id == Tag_P || cur_tag->id == Tag_BR || - cur_tag->id == Tag_HR) && balanced) { + if ((cur_tag->flags & (FL_CLOSED|FL_CLOSING)) && + (cur_tag->id == Tag_P || cur_tag->id == Tag_BR || + cur_tag->id == Tag_HR || cur_tag->id == Tag_TR || + cur_tag->id == Tag_DIV) && balanced) { /* Insert newline */ - g_byte_array_append (dest, "\r\n", 2); + if (dest->data[dest->len - 1] != '\n') { + g_byte_array_append (dest, "\r\n", 2); + } save_space = FALSE; }