diff --git a/td/telegram/LinkManager.cpp b/td/telegram/LinkManager.cpp index ad4175070..25e777381 100644 --- a/td/telegram/LinkManager.cpp +++ b/td/telegram/LinkManager.cpp @@ -1116,8 +1116,9 @@ unique_ptr LinkManager::parse_tg_link_query(Slice que return td::make_unique(PSTRING() << "tg:join?invite=" << url_encode(get_url_query_hash(true, url_query))); } - } else if (path.size() == 1 && path[0] == "addstickers") { + } else if (path.size() == 1 && (path[0] == "addstickers" || path[0] == "addemoji")) { // addstickers?set= + // addemoji?set= if (has_arg("set")) { return td::make_unique(get_arg("set")); } @@ -1255,9 +1256,10 @@ unique_ptr LinkManager::parse_t_me_link_query(Slice q << url_encode(get_url_query_hash(false, url_query))); } } - } else if (path[0] == "addstickers") { + } else if (path[0] == "addstickers" || path[0] == "addemoji") { if (path.size() >= 2 && !path[1].empty()) { // /addstickers/ + // /addemoji/ return td::make_unique(path[1]); } } else if (path[0] == "setlanguage") { diff --git a/test/link.cpp b/test/link.cpp index bc2be9434..eab877481 100644 --- a/test/link.cpp +++ b/test/link.cpp @@ -585,6 +585,24 @@ TEST(Link, parse_internal_link) { parse_internal_link("tg:addstickers?set=abc%30ef", sticker_set("abc0ef")); parse_internal_link("tg://addstickers?set=", unknown_deep_link("tg://addstickers?set=")); + parse_internal_link("t.me/addemoji?set=abcdef", nullptr); + parse_internal_link("t.me/addemoji", nullptr); + parse_internal_link("t.me/addemoji/", nullptr); + parse_internal_link("t.me/addemoji//abcdef", nullptr); + parse_internal_link("t.me/addemoji?/abcdef", nullptr); + parse_internal_link("t.me/addemoji/?abcdef", nullptr); + parse_internal_link("t.me/addemoji/#abcdef", nullptr); + parse_internal_link("t.me/addemoji/abacaba", sticker_set("abacaba")); + parse_internal_link("t.me/addemoji/aba%20aba", sticker_set("aba aba")); + parse_internal_link("t.me/addemoji/123456a", sticker_set("123456a")); + parse_internal_link("t.me/addemoji/12345678901", sticker_set("12345678901")); + parse_internal_link("t.me/addemoji/123456", sticker_set("123456")); + parse_internal_link("t.me/addemoji/123456/123123/12/31/a/s//21w/?asdas#test", sticker_set("123456")); + + parse_internal_link("tg:addemoji?set=abcdef", sticker_set("abcdef")); + parse_internal_link("tg:addemoji?set=abc%30ef", sticker_set("abc0ef")); + parse_internal_link("tg://addemoji?set=", unknown_deep_link("tg://addemoji?set=")); + parse_internal_link("t.me/confirmphone?hash=abc%30ef&phone=", nullptr); parse_internal_link("t.me/confirmphone/123456/123123/12/31/a/s//21w/?hash=abc%30ef&phone=123456789", phone_number_confirmation("abc0ef", "123456789"));