Do not try to reuse file_id without remote location.

GitOrigin-RevId: 2dd994de062d1f640982923e4a7970fd7bbda583
This commit is contained in:
levlam 2020-05-04 16:01:35 +03:00
parent f2e549e361
commit c8f56c62d8

View File

@ -3036,11 +3036,14 @@ Result<FileId> FileManager::get_input_file_id(FileType type, const tl_object_ptr
hash = sha256(r_file_content.ok()); hash = sha256(r_file_content.ok());
auto it = file_hash_to_file_id_.find(hash); auto it = file_hash_to_file_id_.find(hash);
if (it != file_hash_to_file_id_.end()) { if (it != file_hash_to_file_id_.end()) {
auto file_view = get_file_view(it->second);
if (file_view.has_remote_location() && !file_view.remote_location().is_web()) {
return it->second; return it->second;
} }
} }
} }
} }
}
TRY_RESULT(file_id, register_local(FullLocalFileLocation(new_type, path, 0), owner_dialog_id, 0, get_by_hash)); TRY_RESULT(file_id, register_local(FullLocalFileLocation(new_type, path, 0), owner_dialog_id, 0, get_by_hash));
if (!hash.empty()) { if (!hash.empty()) {
file_hash_to_file_id_[hash] = file_id; file_hash_to_file_id_[hash] = file_id;