diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-07-08 16:10:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-07-08 16:10:10 +0100 |
commit | 83855b16bb7fb9c699cd7f4d935e58217bb41ab0 (patch) | |
tree | f91f8a4abb807cf7b7d2f27e1206b7d9be156bae /src/libserver/css/css_value.cxx | |
parent | 7a181b1fe66fcf0fd5a3b94c6ceae7e9a2a08b47 (diff) | |
download | rspamd-83855b16bb7fb9c699cd7f4d935e58217bb41ab0.tar.gz rspamd-83855b16bb7fb9c699cd7f4d935e58217bb41ab0.zip |
[Minor] Fix hex colors parsing
Diffstat (limited to 'src/libserver/css/css_value.cxx')
-rw-r--r-- | src/libserver/css/css_value.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libserver/css/css_value.cxx b/src/libserver/css/css_value.cxx index 799d5f8ef..704905cd4 100644 --- a/src/libserver/css/css_value.cxx +++ b/src/libserver/css/css_value.cxx @@ -40,10 +40,16 @@ namespace rspamd::css { auto css_value::maybe_color_from_string(const std::string_view &input) -> std::optional<css_value> { - auto found_it = css_colors_map.find(input); - if (found_it != css_colors_map.end()) { - return css_value{found_it->second}; + if (input.size() > 1 && input.front() == '#') { + return css_value::maybe_color_from_hex(input.substr(1)); + } + else { + auto found_it = css_colors_map.find(input); + + if (found_it != css_colors_map.end()) { + return css_value{found_it->second}; + } } return std::nullopt; |