diff --git a/td/telegram/misc.cpp b/td/telegram/misc.cpp index 35aa474e3..9405df4a8 100644 --- a/td/telegram/misc.cpp +++ b/td/telegram/misc.cpp @@ -281,19 +281,16 @@ string get_emoji_fingerprint(uint64 num) { Result check_url(Slice url) { bool is_tg = false; bool is_ton = false; - if (begins_with(url, "tg://")) { - url.remove_prefix(5); - is_tg = true; - } else if (begins_with(url, "tg:")) { + if (begins_with(url, "tg:")) { url.remove_prefix(3); is_tg = true; - } else if (begins_with(url, "ton://")) { - url.remove_prefix(6); - is_ton = true; } else if (begins_with(url, "ton:")) { url.remove_prefix(4); is_ton = true; } + if ((is_tg || is_ton) && begins_with(url, "//")) { + url.remove_prefix(2); + } TRY_RESULT(http_url, parse_url(url)); if (is_tg || is_ton) { if (begins_with(url, "http://") || http_url.protocol_ == HttpUrl::Protocol::HTTPS || !http_url.userinfo_.empty() ||