From 4c68ce08d71854ecdb1b67d5f603875eca4cc87e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 9 Apr 2019 09:38:41 +0100 Subject: [PATCH] [Fix] Fix processing of embedded urls --- src/libserver/html.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/libserver/html.c b/src/libserver/html.c index 41925609e..cc74d676e 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -1706,19 +1706,21 @@ rspamd_html_process_img_tag (rspamd_mempool_t *pool, struct html_tag *tag, /* We have an embedded image */ img->flags |= RSPAMD_HTML_FLAG_IMAGE_EMBEDDED; } - if (comp->len > sizeof ("data:") - 1 && memcmp (comp->start, - "data:", sizeof ("data:") - 1) == 0) { - /* We have an embedded image in HTML tag */ - img->flags |= - (RSPAMD_HTML_FLAG_IMAGE_EMBEDDED|RSPAMD_HTML_FLAG_IMAGE_DATA); - rspamd_html_process_data_image (pool, img, comp); - hc->flags |= RSPAMD_HTML_FLAG_HAS_DATA_URLS; - } else { - img->flags |= RSPAMD_HTML_FLAG_IMAGE_EXTERNAL; - if (img->src) { - img->url = rspamd_html_process_url (pool, - img->src, fstr.len, NULL); + if (comp->len > sizeof ("data:") - 1 && memcmp (comp->start, + "data:", sizeof ("data:") - 1) == 0) { + /* We have an embedded image in HTML tag */ + img->flags |= + (RSPAMD_HTML_FLAG_IMAGE_EMBEDDED | RSPAMD_HTML_FLAG_IMAGE_DATA); + rspamd_html_process_data_image (pool, img, comp); + hc->flags |= RSPAMD_HTML_FLAG_HAS_DATA_URLS; + } + else { + img->flags |= RSPAMD_HTML_FLAG_IMAGE_EXTERNAL; + if (img->src) { + img->url = rspamd_html_process_url (pool, + img->src, fstr.len, NULL); + } } } } -- 2.39.5