From af3c33e4810616f423634aaf388ea0a9c1bcbf73 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 10 Oct 2022 12:11:40 +0300 Subject: [PATCH] Simplify local location check in FileManager::download. --- td/telegram/files/FileManager.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 1c92de1e1..31ea8bcf6 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -2209,22 +2209,16 @@ void FileManager::download(FileId file_id, std::shared_ptr cal return; } + auto status = check_local_location(node, true); + if (status.is_error()) { + LOG(WARNING) << "Need to redownload file " << file_id << ": " << status; + } if (node->local_.type() == LocalFileLocation::Type::Full) { - auto status = check_local_location(node, true); - if (status.is_error()) { - LOG(WARNING) << "Need to redownload file " << file_id << ": " << status; - } else { - LOG(INFO) << "File " << file_id << " is already downloaded"; - if (callback) { - callback->on_download_ok(file_id); - } - return; - } - } else if (node->local_.type() == LocalFileLocation::Type::Partial) { - auto status = check_local_location(node, true); - if (status.is_error()) { - LOG(WARNING) << "Need to download file " << file_id << " from beginning: " << status; + LOG(INFO) << "File " << file_id << " is already downloaded"; + if (callback) { + callback->on_download_ok(file_id); } + return; } FileView file_view(node);