Add more t.me subdomains to exceptions.

This commit is contained in:
levlam 2023-10-07 11:42:20 +03:00
parent 06e01a9ebd
commit 409dda8d77
2 changed files with 11 additions and 4 deletions

View File

@ -1084,10 +1084,10 @@ LinkManager::LinkInfo LinkManager::get_link_info(Slice link) {
if (ends_with(host, ".t.me") && host.size() >= 9 && host.find('.') == host.size() - 5) { if (ends_with(host, ".t.me") && host.size() >= 9 && host.find('.') == host.size() - 5) {
Slice subdomain(&host[0], host.size() - 5); Slice subdomain(&host[0], host.size() - 5);
if (is_valid_username(subdomain) && subdomain != "addemoji" && subdomain != "addlist" && if (is_valid_username(subdomain) && subdomain != "addemoji" && subdomain != "addlist" &&
subdomain != "addstickers" && subdomain != "addtheme" && subdomain != "auth" && subdomain != "confirmphone" && subdomain != "addstickers" && subdomain != "addtheme" && subdomain != "auth" && subdomain != "boost" &&
subdomain != "invoice" && subdomain != "joinchat" && subdomain != "login" && subdomain != "proxy" && subdomain != "confirmphone" && subdomain != "contact" && subdomain != "invoice" && subdomain != "joinchat" &&
subdomain != "setlanguage" && subdomain != "share" && subdomain != "socks" && subdomain != "web" && subdomain != "login" && subdomain != "proxy" && subdomain != "setlanguage" && subdomain != "share" &&
subdomain != "k" && subdomain != "z") { subdomain != "socks" && subdomain != "web" && subdomain != "a" && subdomain != "k" && subdomain != "z") {
result.type_ = LinkType::TMe; result.type_ = LinkType::TMe;
result.query_ = PSTRING() << '/' << subdomain << http_url.query_; result.query_ = PSTRING() << '/' << subdomain << http_url.query_;
return result; return result;

View File

@ -1248,12 +1248,19 @@ TEST(Link, parse_internal_link_part4) {
parse_internal_link("aaa_.t.me/12345?single", nullptr); parse_internal_link("aaa_.t.me/12345?single", nullptr);
parse_internal_link("0aaa.t.me/12345?single", nullptr); parse_internal_link("0aaa.t.me/12345?single", nullptr);
parse_internal_link("_aaa.t.me/12345?single", nullptr); parse_internal_link("_aaa.t.me/12345?single", nullptr);
parse_internal_link("a.t.me", nullptr);
parse_internal_link("b.t.me", nullptr);
parse_internal_link("k.t.me", nullptr);
parse_internal_link("z.t.me", nullptr);
parse_internal_link("web.t.me", nullptr);
parse_internal_link("addemoji.t.me", nullptr); parse_internal_link("addemoji.t.me", nullptr);
parse_internal_link("addlist.t.me", nullptr); parse_internal_link("addlist.t.me", nullptr);
parse_internal_link("addstickers.t.me", nullptr); parse_internal_link("addstickers.t.me", nullptr);
parse_internal_link("addtheme.t.me", nullptr); parse_internal_link("addtheme.t.me", nullptr);
parse_internal_link("auth.t.me", nullptr); parse_internal_link("auth.t.me", nullptr);
parse_internal_link("boost.t.me", nullptr);
parse_internal_link("confirmphone.t.me", nullptr); parse_internal_link("confirmphone.t.me", nullptr);
parse_internal_link("contact.t.me", nullptr);
parse_internal_link("invoice.t.me", nullptr); parse_internal_link("invoice.t.me", nullptr);
parse_internal_link("joinchat.t.me", nullptr); parse_internal_link("joinchat.t.me", nullptr);
parse_internal_link("login.t.me", nullptr); parse_internal_link("login.t.me", nullptr);