diff --git a/Telegram/SourceFiles/iv/iv_instance.cpp b/Telegram/SourceFiles/iv/iv_instance.cpp index 62527e35f..2362a6b61 100644 --- a/Telegram/SourceFiles/iv/iv_instance.cpp +++ b/Telegram/SourceFiles/iv/iv_instance.cpp @@ -838,6 +838,9 @@ void Instance::show( _shownSession = session; _shown->events() | rpl::start_with_next([=](Controller::Event event) { using Type = Controller::Event::Type; + const auto lower = event.url.toLower(); + const auto urlChecked = lower.startsWith("http://") + || lower.startsWith("https://"); switch (event.type) { case Type::Close: _shown = nullptr; @@ -852,7 +855,9 @@ void Instance::show( processJoinChannel(event.context); break; case Type::OpenLinkExternal: - File::OpenUrl(event.url); + if (urlChecked) { + File::OpenUrl(event.url); + } closeAll(); break; case Type::OpenMedia: @@ -891,6 +896,9 @@ void Instance::show( break; case Type::OpenPage: case Type::OpenLink: + if (!urlChecked) { + break; + } _shownSession->api().request(MTPmessages_GetWebPage( MTP_string(event.url), MTP_int(0) diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp index c9f3f93f8..262c852d5 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_bot_webview.cpp @@ -800,12 +800,11 @@ void Panel::openExternalLink(const QJsonObject &args) { _delegate->botClose(); return; } - const auto url = args["url"].toString(); const auto iv = args["try_instant_view"].toBool(); + const auto url = args["url"].toString(); const auto lower = url.toLower(); - if (url.isEmpty() - || (!lower.startsWith("http://") && !lower.startsWith("https://"))) { - LOG(("BotWebView Error: Bad 'url' in openExternalLink.")); + if (!lower.startsWith("http://") && !lower.startsWith("https://")) { + LOG(("BotWebView Error: Bad url in openExternalLink: %1").arg(url)); _delegate->botClose(); return; } else if (!allowOpenLink()) {