From 203591d295381c046f169183bd0cf2c6e92fdbcb Mon Sep 17 00:00:00 2001 From: levlam Date: Sat, 6 Jul 2024 22:05:55 +0300 Subject: [PATCH] Fallback to linkPreviewTypePhoto if have photo for unknown embed. --- td/telegram/WebPagesManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/td/telegram/WebPagesManager.cpp b/td/telegram/WebPagesManager.cpp index 11f890ba6..43bf65d18 100644 --- a/td/telegram/WebPagesManager.cpp +++ b/td/telegram/WebPagesManager.cpp @@ -1528,6 +1528,10 @@ td_api::object_ptr WebPagesManager::get_link_preview_ty return td_api::make_object( web_page->embed_url_, web_page->embed_type_, std::move(audio), web_page->duration_, web_page->author_); } else { + if (!web_page->photo_.is_empty()) { + return td_api::make_object( + get_photo_object(td_->file_manager_.get(), web_page->photo_), web_page->author_); + } return td_api::make_object(); } } @@ -1540,6 +1544,10 @@ td_api::object_ptr WebPagesManager::get_link_preview_ty web_page->embed_url_, web_page->embed_type_, std::move(video), web_page->embed_dimensions_.width, web_page->embed_dimensions_.height, web_page->duration_, web_page->author_); } else { + if (!web_page->photo_.is_empty()) { + return td_api::make_object( + get_photo_object(td_->file_manager_.get(), web_page->photo_), web_page->author_); + } return td_api::make_object(); } }