diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 5f9d4a017..7b2d22eea 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -8349,6 +8349,15 @@ void ContactsManager::on_load_chat_full_from_database(ChatId chat_id, string val get_bot_info_force(participant.user_id); } + Chat *c = get_chat(chat_id); + CHECK(c != nullptr); + if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() != + td_->file_manager_->get_file_view(as_dialog_photo(chat_full->photo).small_file_id).get_unique_file_id()) { + chat_full->photo = Photo(); + if (c->photo.small_file_id.is_valid()) { + reload_chat_full(chat_id, Auto()); + } + } on_update_chat_full_photo(chat_full, chat_id, std::move(chat_full->photo)); update_chat_full(chat_full, chat_id, true); @@ -8427,6 +8436,15 @@ void ContactsManager::on_load_channel_full_from_database(ChannelId channel_id, s get_bot_info_force(user_id); } + Channel *c = get_channel(channel_id); + CHECK(c != nullptr); + if (td_->file_manager_->get_file_view(c->photo.small_file_id).get_unique_file_id() != + td_->file_manager_->get_file_view(as_dialog_photo(channel_full->photo).small_file_id).get_unique_file_id()) { + channel_full->photo = Photo(); + if (c->photo.small_file_id.is_valid()) { + channel_full->expires_at = 0.0; + } + } on_update_channel_full_photo(channel_full, channel_id, std::move(channel_full->photo)); update_channel_full(channel_full, channel_id, true); diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 043552af0..0f99d9724 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -756,23 +756,27 @@ string FileView::get_persistent_id(const FullRemoteFileLocation &location) { } string FileView::get_persistent_file_id() const { - if (has_alive_remote_location()) { - return get_persistent_id(remote_location()); - } else if (has_url()) { - return url(); - } else if (has_generate_location() && begins_with(generate_location().conversion_, "#map#")) { - return get_persistent_id(generate_location()); + if (!empty()) { + if (has_alive_remote_location()) { + return get_persistent_id(remote_location()); + } else if (has_url()) { + return url(); + } else if (has_generate_location() && begins_with(generate_location().conversion_, "#map#")) { + return get_persistent_id(generate_location()); + } } return string(); } string FileView::get_unique_file_id() const { - if (has_alive_remote_location()) { - if (!remote_location().is_web()) { - return get_unique_id(remote_location()); + if (!empty()) { + if (has_alive_remote_location()) { + if (!remote_location().is_web()) { + return get_unique_id(remote_location()); + } + } else if (has_generate_location() && begins_with(generate_location().conversion_, "#map#")) { + return get_unique_id(generate_location()); } - } else if (has_generate_location() && begins_with(generate_location().conversion_, "#map#")) { - return get_unique_id(generate_location()); } return string(); }