From 825645df65a4fcd3f7fef55f5b6ba8655dca594b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 13 Jul 2016 17:02:16 +0100 Subject: [PATCH] [Fix] Fix processing of
and
tags --- src/libserver/html.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/libserver/html.c b/src/libserver/html.c index 7fbe58523..0a25e488a 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1912,11 +1912,17 @@ rspamd_html_process_part_full (rspamd_mempool_t *pool, struct html_content *hc, setbit (hc->tags_seen, cur_tag->id); } - 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 || + /* Handle newlines */ + if (cur_tag->id == Tag_BR || cur_tag->id == Tag_HR) { + if (dest->len > 0 && dest->data[dest->len - 1] != '\n') { + g_byte_array_append (dest, "\r\n", 2); + } + save_space = FALSE; + } + else if ((cur_tag->flags & (FL_CLOSED|FL_CLOSING)) && + (cur_tag->id == Tag_P || + cur_tag->id == Tag_TR || cur_tag->id == Tag_DIV) && balanced) { - /* Insert newline */ if (dest->len > 0 && dest->data[dest->len - 1] != '\n') { g_byte_array_append (dest, "\r\n", 2); } -- 2.39.5