From: Vsevolod Stakhov Date: Tue, 20 Jul 2021 13:39:20 +0000 (+0100) Subject: [Minor] Lowercase id and class components X-Git-Tag: 3.0~126 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d12d563873826906bdd2d16f45818d3811ff73d2;p=thirdparty%2Frspamd.git [Minor] Lowercase id and class components --- diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index 0925a76952..d60210ba6e 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -269,7 +269,16 @@ html_parse_tag_content(rspamd_mempool_t *pool, else { /* We need to copy buf to a persistent storage */ auto *s = rspamd_mempool_alloc_buffer(pool, parser_env.buf.size()); - memcpy(s, parser_env.buf.data(), parser_env.buf.size()); + + if (parser_env.cur_component.value() == html_component_type::RSPAMD_HTML_COMPONENT_ID || + parser_env.cur_component.value() == html_component_type::RSPAMD_HTML_COMPONENT_CLASS) { + /* Lowercase */ + rspamd_str_copy_lc(parser_env.buf.data(), s, parser_env.buf.size()); + } + else { + memcpy(s, parser_env.buf.data(), parser_env.buf.size()); + } + auto sz = rspamd_html_decode_entitles_inplace(s, parser_env.buf.size()); tag->components.emplace_back(parser_env.cur_component.value(), std::string_view{s, sz}); @@ -1104,7 +1113,8 @@ html_append_tag_content(rspamd_mempool_t *pool, is_visible = false; } else { - if (tag->block->has_display() && tag->block->display == css::css_display_value::DISPLAY_HIDDEN) { + if (tag->block->has_display() && + tag->block->display == css::css_display_value::DISPLAY_HIDDEN) { is_visible = false; } else {