From 3373ac8aa8d1492fade8b0721d1b8f22cee7abc3 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 14 Nov 2022 18:30:10 +0300 Subject: [PATCH] Don't replace cached file_id of being uploaded files. --- td/telegram/files/FileManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 5f928c55a..9cbcb058a 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -3270,6 +3270,7 @@ Result FileManager::get_input_file_id(FileType type, const tl_object_ptr if (r_file_content.is_ok()) { hash = sha256(r_file_content.ok()); auto file_id = file_hash_to_file_id_.get(hash); + LOG(INFO) << "Found file " << file_id << " by hash " << hex_encode(hash); if (file_id.is_valid()) { auto file_view = get_file_view(file_id); if (!file_view.empty()) { @@ -3279,6 +3280,9 @@ Result FileManager::get_input_file_id(FileType type, const tl_object_ptr if (file_view.has_remote_location() && !file_view.remote_location().is_web()) { return file_id; } + if (file_view.is_uploading()) { + hash.clear(); + } } } }