From 9ef2f370ac19953d74760cd0ce1f17f2ec82d1d6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 5 Sep 2022 12:22:43 +0400 Subject: [PATCH] Handle only username subdomains for t.me domain. --- Telegram/SourceFiles/core/local_url_handlers.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/core/local_url_handlers.cpp b/Telegram/SourceFiles/core/local_url_handlers.cpp index 4c9905195..51545bb7f 100644 --- a/Telegram/SourceFiles/core/local_url_handlers.cpp +++ b/Telegram/SourceFiles/core/local_url_handlers.cpp @@ -880,7 +880,14 @@ QString TryConvertUrlToLocal(QString url) { if (subdomainMatch) { const auto name = subdomainMatch->captured(2); if (name.size() > 1 && name != "www") { - url = subdomainMatch->captured(1) + "t.me/" + name + subdomainMatch->captured(3); + const auto result = TryConvertUrlToLocal( + subdomainMatch->captured(1) + + "t.me/" + + name + + subdomainMatch->captured(3)); + return result.startsWith("tg://resolve?domain=") + ? result + : url; } } auto telegramMeMatch = regex_match(qsl("^(https?://)?(www\\.)?(telegram\\.(me|dog)|t\\.me)/(.+)$"), url, matchOptions);