Enable minithumbnail

This commit is contained in:
Andrea Cavalli 2022-05-04 18:31:02 +02:00
parent 4cd31ceb93
commit 296c2bfb81

View File

@ -79,6 +79,9 @@ bool need_update_dialog_photo_minithumbnail(const string &from, const string &to
} }
td_api::object_ptr<td_api::minithumbnail> get_minithumbnail_object(const string &packed) { td_api::object_ptr<td_api::minithumbnail> get_minithumbnail_object(const string &packed) {
if (G()->shared_config().get_option_boolean("disable_minithumbnails")) {
return nullptr;
}
if (packed.size() < 3) { if (packed.size() < 3) {
return nullptr; return nullptr;
} }
@ -228,11 +231,23 @@ Variant<PhotoSize, string> get_photo_size(FileManager *file_manager, PhotoSizeSo
case telegram_api::photoStrippedSize::ID: { case telegram_api::photoStrippedSize::ID: {
auto size = move_tl_object_as<telegram_api::photoStrippedSize>(size_ptr); auto size = move_tl_object_as<telegram_api::photoStrippedSize>(size_ptr);
if (format != PhotoFormat::Jpeg) { if (format != PhotoFormat::Jpeg) {
LOG(ERROR) << "Receive unexpected JPEG minithumbnail in photo " << id << " from " << source << " of format " if (G()->shared_config().get_option_boolean("disable_minithumbnails")) {
<< format; LOG(DEBUG) << "Receive unexpected JPEG minithumbnail";
return std::move(res); } else {
LOG(ERROR) << "Receive unexpected JPEG minithumbnail in photo " << id << " from " << source << " of format "
<< format;
}
if (G()->shared_config().get_option_boolean("disable_minithumbnails")) {
return std::string("");
} else {
return std::move(res);
}
}
if (G()->shared_config().get_option_boolean("disable_minithumbnails")) {
return std::string("");
} else {
return size->bytes_.as_slice().str();
} }
return size->bytes_.as_slice().str();
} }
case telegram_api::photoSizeProgressive::ID: { case telegram_api::photoSizeProgressive::ID: {
auto size = move_tl_object_as<telegram_api::photoSizeProgressive>(size_ptr); auto size = move_tl_object_as<telegram_api::photoSizeProgressive>(size_ptr);