diff --git a/td/telegram/DraftMessage.cpp b/td/telegram/DraftMessage.cpp index badc2a77f..e5a3e7c91 100644 --- a/td/telegram/DraftMessage.cpp +++ b/td/telegram/DraftMessage.cpp @@ -51,7 +51,7 @@ unique_ptr get_draft_message(ContactsManager *contacts_manager, if (!clean_input_string(draft->message_)) { draft->message_.clear(); } - entities.clear(); + entities = find_entities(draft->message_, false); } result->input_message_text.text = FormattedText{std::move(draft->message_), std::move(entities)}; result->input_message_text.disable_web_page_preview = (flags & telegram_api::draftMessage::NO_WEBPAGE_MASK) != 0; diff --git a/td/telegram/MessageEntity.cpp b/td/telegram/MessageEntity.cpp index fc33325e6..d2b6c3d85 100644 --- a/td/telegram/MessageEntity.cpp +++ b/td/telegram/MessageEntity.cpp @@ -3088,7 +3088,7 @@ FormattedText get_message_text(const ContactsManager *contacts_manager, string m if (!clean_input_string(message_text)) { message_text.clear(); } - entities.clear(); + entities = find_entities(message_text, false); } return FormattedText{std::move(message_text), std::move(entities)}; } diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index d503f25d4..ef9253d5e 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -457,7 +457,7 @@ class GetDeepLinkInfoQuery : public Td::ResultHandler { if (!clean_input_string(info->message_)) { info->message_.clear(); } - entities.clear(); + entities = find_entities(info->message_, true); } FormattedText text{std::move(info->message_), std::move(entities)}; return promise_.set_value( diff --git a/td/telegram/TermsOfService.cpp b/td/telegram/TermsOfService.cpp index 943c1b249..359c7e74b 100644 --- a/td/telegram/TermsOfService.cpp +++ b/td/telegram/TermsOfService.cpp @@ -100,7 +100,7 @@ TermsOfService::TermsOfService(telegram_api::object_ptrtext_)) { terms->text_.clear(); } - entities.clear(); + entities = find_entities(terms->text_, true); } if (terms->text_.empty()) { id_.clear(); diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index ac1d60d46..e15225866 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -748,7 +748,7 @@ int64 WebPagesManager::get_web_page_preview(td_api::object_ptrtext_, entities, true, false, true, false); - if (text->text_.empty()) { + if (result.is_error() || text->text_.empty()) { promise.set_value(Unit()); return 0; }