diff --git a/td/telegram/DownloadManager.cpp b/td/telegram/DownloadManager.cpp index 491a67574..be3c6c785 100644 --- a/td/telegram/DownloadManager.cpp +++ b/td/telegram/DownloadManager.cpp @@ -377,6 +377,11 @@ class DownloadManagerImpl final : public DownloadManager { CHECK(file_info != nullptr); auto download_id = file_info->download_id; file_info->internal_file_id = callback_->dup_file_id(file_info->file_id); + auto file_view = callback_->get_file_view(file_info->file_id); + CHECK(!file_view.empty()); + file_info->size = file_view.expected_size(); + file_info->downloaded_size = file_view.local_total_size(); + by_internal_file_id_[file_info->internal_file_id] = download_id; by_file_id_[file_info->file_id] = download_id; hints_.add(download_id, search_text.empty() ? string(" ") : search_text); diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 3da604ab4..7610e99cd 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4027,7 +4027,7 @@ void Td::init_managers() { auto td = G()->td().get_actor_unsafe(); auto file_view = td->file_manager_->get_file_view(file_id); send_closure(download_manager_, &DownloadManager::update_file_download_state, file_id, - file_view.local_total_size(), file_view.size(), !file_view.is_downloading()); + file_view.local_total_size(), file_view.expected_size(), !file_view.is_downloading()); // TODO: handle deleted state? } void on_download_ok(FileId file_id) final {