From e941622e32276d08ef51d45b500afadb4cd542d2 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 7 May 2020 15:56:57 +0300 Subject: [PATCH] Ignore file_reference errors for bots, because corresponding file_ids may not be duped. GitOrigin-RevId: 3cf82083a6d3e5556f665bad9ad00e216c7901a0 --- td/telegram/AnimationsManager.cpp | 2 +- td/telegram/ContactsManager.cpp | 2 +- td/telegram/MessagesManager.cpp | 8 ++++---- td/telegram/StickersManager.cpp | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/td/telegram/AnimationsManager.cpp b/td/telegram/AnimationsManager.cpp index aa19b174..e0a91aa4 100644 --- a/td/telegram/AnimationsManager.cpp +++ b/td/telegram/AnimationsManager.cpp @@ -102,7 +102,7 @@ class SaveGifQuery : public Td::ResultHandler { } void on_error(uint64 id, Status status) override { - if (FileReferenceManager::is_file_reference_error(status)) { + if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { VLOG(file_references) << "Receive " << status << " for " << file_id_; td->file_manager_->delete_file_reference(file_id_, file_reference_); td->file_reference_manager_->repair_file_reference( diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index 0b9c8d3f..46f649a7 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -870,7 +870,7 @@ class UpdateProfilePhotoQuery : public Td::ResultHandler { } void on_error(uint64 id, Status status) override { - if (FileReferenceManager::is_file_reference_error(status)) { + if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { if (file_id_.is_valid()) { VLOG(file_references) << "Receive " << status << " for " << file_id_; td->file_manager_->delete_file_reference(file_id_, file_reference_); diff --git a/td/telegram/MessagesManager.cpp b/td/telegram/MessagesManager.cpp index 5aa5465e..157aab91 100644 --- a/td/telegram/MessagesManager.cpp +++ b/td/telegram/MessagesManager.cpp @@ -744,7 +744,7 @@ class EditDialogPhotoQuery : public Td::ResultHandler { if (file_id_.is_valid() && was_uploaded_) { td->file_manager_->delete_partial_remote_location(file_id_); } - if (FileReferenceManager::is_file_reference_error(status)) { + if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { if (file_id_.is_valid() && !was_uploaded_) { VLOG(file_references) << "Receive " << status << " for " << file_id_; td->file_manager_->delete_file_reference(file_id_, file_reference_); @@ -2205,7 +2205,7 @@ class SendMultiMediaActor : public NetActorOnce { // do not send error, message will be re-sent return; } - if (FileReferenceManager::is_file_reference_error(status)) { + if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { auto pos = FileReferenceManager::get_file_reference_error_pos(status); if (1 <= pos && pos <= file_ids_.size() && file_ids_[pos - 1].is_valid()) { VLOG(file_references) << "Receive " << status << " for " << file_ids_[pos - 1]; @@ -2316,7 +2316,7 @@ class SendMediaActor : public NetActorOnce { td->file_manager_->delete_partial_remote_location(file_id_); } } - } else if (FileReferenceManager::is_file_reference_error(status)) { + } else if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { if (file_id_.is_valid() && !was_uploaded_) { VLOG(file_references) << "Receive " << status << " for " << file_id_; td->file_manager_->delete_file_reference(file_id_, file_reference_); @@ -19969,7 +19969,7 @@ void MessagesManager::on_message_media_edited(DialogId dialog_id, MessageId mess if (result.error().code() != 429 && result.error().code() < 500 && !G()->close_flag()) { td_->file_manager_->delete_partial_remote_location(file_id); } - } else if (FileReferenceManager::is_file_reference_error(result.error())) { + } else if (!td_->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(result.error())) { if (file_id.is_valid()) { VLOG(file_references) << "Receive " << result.error() << " for " << file_id; td_->file_manager_->delete_file_reference(file_id, file_reference); diff --git a/td/telegram/StickersManager.cpp b/td/telegram/StickersManager.cpp index 40f7dd07..3eebe977 100644 --- a/td/telegram/StickersManager.cpp +++ b/td/telegram/StickersManager.cpp @@ -352,7 +352,7 @@ class GetAttachedStickerSetsQuery : public Td::ResultHandler { } void on_error(uint64 id, Status status) override { - if (FileReferenceManager::is_file_reference_error(status)) { + if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { VLOG(file_references) << "Receive " << status << " for " << file_id_; td->file_manager_->delete_file_reference(file_id_, file_reference_); td->file_reference_manager_->repair_file_reference( @@ -454,7 +454,7 @@ class SaveRecentStickerQuery : public Td::ResultHandler { } void on_error(uint64 id, Status status) override { - if (FileReferenceManager::is_file_reference_error(status)) { + if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { VLOG(file_references) << "Receive " << status << " for " << file_id_; td->file_manager_->delete_file_reference(file_id_, file_reference_); td->file_reference_manager_->repair_file_reference( @@ -587,7 +587,7 @@ class FaveStickerQuery : public Td::ResultHandler { } void on_error(uint64 id, Status status) override { - if (FileReferenceManager::is_file_reference_error(status)) { + if (!td->auth_manager_->is_bot() && FileReferenceManager::is_file_reference_error(status)) { VLOG(file_references) << "Receive " << status << " for " << file_id_; td->file_manager_->delete_file_reference(file_id_, file_reference_); td->file_reference_manager_->repair_file_reference(