From 00a70b466def6fe62b3d5be8935fcd64fce8bc24 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 9 Apr 2020 18:43:27 +0300 Subject: [PATCH] Do not add file source from self-destructing messages. GitOrigin-RevId: 5ac703d188ec532a52efa8549ee8c7e63a78a78b --- td/telegram/MessagesManager.cpp | 8 ++++++++ td/telegram/files/FileManager.cpp | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index c5aaeaacc..01416be9c 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -16653,6 +16653,10 @@ FileSourceId MessagesManager::get_message_file_source_id(FullMessageId full_mess } void MessagesManager::add_message_file_sources(DialogId dialog_id, const Message *m) { + if (dialog_id.get_type() != DialogType::SecretChat && m->is_content_secret) { + return; + } + auto file_ids = get_message_content_file_ids(m->content.get(), td_); if (file_ids.empty()) { return; @@ -16683,6 +16687,10 @@ void MessagesManager::remove_message_file_sources(DialogId dialog_id, const Mess } void MessagesManager::change_message_files(DialogId dialog_id, const Message *m, const vector &old_file_ids) { + if (dialog_id.get_type() != DialogType::SecretChat && m->is_content_secret) { + return; + } + auto new_file_ids = get_message_content_file_ids(m->content.get(), td_); if (new_file_ids == old_file_ids) { return; diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 4c62ea2b4..d0cdd19bf 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -4,6 +4,7 @@ // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // + #include "td/telegram/files/FileManager.h" #include "td/telegram/telegram_api.h" @@ -2620,7 +2621,6 @@ void FileManager::run_upload(FileNodePtr node, std::vector bad_parts) { return; } - FileView file_view(node); if (!file_view.has_local_location() && !file_view.has_remote_location()) { if (node->get_by_hash_ || node->generate_id_ == 0 || !node->generate_was_update_) {