khash_t(tag_by_id) *html_tag_by_id;
khash_t(color_by_name) *html_color_by_name;
+static struct rspamd_url *rspamd_html_process_url (rspamd_mempool_t *pool,
+ const gchar *start, guint len,
+ struct html_tag_component *comp,
+ bool is_image);
+
static void
rspamd_html_library_init (void)
{
struct rspamd_url *
rspamd_html_process_url (rspamd_mempool_t *pool, const gchar *start, guint len,
- struct html_tag_component *comp)
+ struct html_tag_component *comp, bool is_image)
{
struct rspamd_url *url;
guint saved_flags = 0;
}
}
- rc = rspamd_url_parse (url, decoded, dlen, pool, RSPAMD_URL_PARSE_HREF);
+ rc = rspamd_url_parse (url, decoded, dlen, pool,
+ is_image ? RSPAMD_URL_PARSE_TEXT :RSPAMD_URL_PARSE_HREF);
/* Filter some completely damaged urls */
if (rc == URI_ERRNO_OK && url->hostlen > 0 &&
}
}
- url = rspamd_html_process_url (pool, start, len, comp);
+ url = rspamd_html_process_url (pool, start, len, comp, false);
if (url && tag->extra == NULL) {
tag->extra = url;
if (img->src) {
img->url = rspamd_html_process_url (pool,
- img->src, fstr.len, NULL);
+ img->src, fstr.len, NULL, true);
if (img->url) {
img->url->flags |= RSPAMD_URL_FLAG_IMAGE;