diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index 0c2469459..79556ac5b 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -1126,7 +1126,8 @@ vector find_mentions(Slice str) { if (mention.size() >= 5) { return false; } - return get_valid_short_usernames().count(mention) == 0; + auto lowered_mention = to_lower(mention); + return get_valid_short_usernames().count(lowered_mention) == 0; }); return mentions; } diff --git a/test/message_entities.cpp b/test/message_entities.cpp index d65bc320f..18d3a3f4c 100644 --- a/test/message_entities.cpp +++ b/test/message_entities.cpp @@ -44,8 +44,9 @@ TEST(MessageEntities, mention) { check_mention("@abcdefghijklmnopqrstuvwxyz123456", {"@abcdefghijklmnopqrstuvwxyz123456"}); check_mention("@abcdefghijklmnopqrstuvwxyz1234567", {}); check_mention("нет@mention", {}); - check_mention("@ya @gif @wiki @vid @bing @pic @bold @imdb @coub @like @vote @giff @cap ya cap @y @yar @bingg @bin", - {"@gif", "@wiki", "@vid", "@bing", "@pic", "@bold", "@imdb", "@coub", "@like", "@vote", "@bingg"}); + check_mention( + "@ya @gif @wiki @vid @bing @pic @bold @imdb @ImDb @coub @like @vote @giff @cap ya cap @y @yar @bingg @bin", + {"@gif", "@wiki", "@vid", "@bing", "@pic", "@bold", "@imdb", "@ImDb", "@coub", "@like", "@vote", "@bingg"}); }; static void check_bot_command(const td::string &str, const td::vector &expected) {