From c13068832b384a16c6131f5e5e480a401dcff615 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 18 May 2020 16:23:30 +0300 Subject: [PATCH] Remove excessive user photos instead of adjusting total_count. GitOrigin-RevId: c66c645eb83e44a62172aff87a576d8b8d04368f --- td/telegram/ContactsManager.cpp | 7 ++----- td/telegram/cli.cpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index c1ad3aa7..c01f3bc9 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -8892,7 +8892,7 @@ void ContactsManager::on_get_user_photos(UserId user_id, int32 offset, int32 lim total_count = min_total_count; } LOG_IF(ERROR, limit < photo_count) << "Requested not more than " << limit << " photos, but " << photo_count - << " returned"; + << " received"; User *u = get_user(user_id); if (u == nullptr) { @@ -8962,11 +8962,8 @@ void ContactsManager::on_get_user_photos(UserId user_id, int32 offset, int32 lim } auto known_photo_count = narrow_cast(user_photos->photos.size()); - CHECK(user_photos->count >= known_photo_count); if (user_photos->offset + known_photo_count > user_photos->count) { - LOG(ERROR) << "Fix total photo count of " << user_id << " from " << user_photos->count << " to " - << user_photos->offset << " + " << known_photo_count; - user_photos->count = user_photos->offset + known_photo_count; + user_photos->photos.resize(user_photos->count - user_photos->offset); } } diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index c18e5923..d10d94ef 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -1994,7 +1994,7 @@ class CliClient final : public Actor { send_request(td_api::make_object( as_chat_id(chat_id), get_search_messages_filter(filter), as_bool(return_local))); - } else if (op == "gup" || op == "GetUserPhotos") { + } else if (op == "gup" || op == "gupf") { string user_id; string offset; string limit;