diff --git a/td/telegram/InputMessageText.cpp b/td/telegram/InputMessageText.cpp index cb8264bcf..7c1803c07 100644 --- a/td/telegram/InputMessageText.cpp +++ b/td/telegram/InputMessageText.cpp @@ -57,6 +57,9 @@ Result process_input_message_text(const Td *td, DialogId dialo force_large_media = false; } } + if (!disable_web_page_preview && web_page_url.empty() && dialog_id.get_type() == DialogType::SecretChat) { + web_page_url = get_first_url(text); + } return InputMessageText{std::move(text), std::move(web_page_url), disable_web_page_preview, force_small_media, force_large_media, input_message_text->clear_draft_}; } diff --git a/td/telegram/MessageContent.cpp b/td/telegram/MessageContent.cpp index 0dfdb1187..d654695bd 100644 --- a/td/telegram/MessageContent.cpp +++ b/td/telegram/MessageContent.cpp @@ -2719,12 +2719,10 @@ SecretInputMedia get_secret_input_media(const MessageContent *content, Td *td, CHECK(input_file == nullptr); CHECK(thumbnail.empty()); const auto *m = static_cast(content); - auto web_page_url = - !m->web_page_url.empty() ? m->web_page_url : td->web_pages_manager_->get_web_page_url(m->web_page_id); - if (web_page_url.empty()) { + if (m->web_page_url.empty()) { return SecretInputMedia{}; } - return SecretInputMedia{nullptr, make_tl_object(web_page_url)}; + return SecretInputMedia{nullptr, make_tl_object(m->web_page_url)}; } case MessageContentType::Venue: { const auto *m = static_cast(content);