Don't replace cached file_id of being uploaded files.

This commit is contained in:
levlam 2022-11-14 18:30:10 +03:00
parent 59d4248efb
commit 3373ac8aa8

View File

@ -3270,6 +3270,7 @@ Result<FileId> 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<FileId> 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();
}
}
}
}