diff --git a/td/telegram/ReplyMarkup.cpp b/td/telegram/ReplyMarkup.cpp index af0d18205..423478554 100644 --- a/td/telegram/ReplyMarkup.cpp +++ b/td/telegram/ReplyMarkup.cpp @@ -440,13 +440,24 @@ static Result get_keyboard_button(tl_object_ptr(button->type_); + auto user_id = LinkManager::get_link_user_id(button_type->url_); + if (user_id.is_valid()) { + return Status::Error(400, "Link to a user can't be used in web view URL buttons"); + } + auto r_url = LinkManager::check_link(button_type->url_); + if (r_url.is_error()) { + return Status::Error(400, "Inline keyboard button web view URL is invalid"); + } current_button.type = KeyboardButton::Type::WebView; - current_button.url = std::move(static_cast(button->type_.get())->url_); + current_button.url = std::move(button_type->url_); break; + } default: UNREACHABLE(); } @@ -560,7 +571,6 @@ static Result get_inline_keyboard_button(tl_object_ptrurl_); if (user_id.is_valid()) { return Status::Error(400, "Link to a user can't be used in web view URL buttons"); - break; } auto r_url = LinkManager::check_link(button_type->url_); if (r_url.is_error()) {