aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/html.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-13 17:02:16 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-07-13 17:07:23 +0100
commit825645df65a4fcd3f7fef55f5b6ba8655dca594b (patch)
tree1174388cb263d579eaf3aeb40d2003550ed95687 /src/libserver/html.c
parentf6be35df32664c477b345cfb2c82dcdaa3d3cf08 (diff)
downloadrspamd-825645df65a4fcd3f7fef55f5b6ba8655dca594b.tar.gz
rspamd-825645df65a4fcd3f7fef55f5b6ba8655dca594b.zip
[Fix] Fix processing of <br> and <hr> tags
Diffstat (limited to 'src/libserver/html.c')
-rw-r--r--src/libserver/html.c14
1 files 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);
}