Precerve file remote in check_input_file_id.
GitOrigin-RevId: 52a3d32a606b8907f1ab94b7c10c2413346e66ec
This commit is contained in:
parent
fd5b5d6e55
commit
27a0bbd158
@ -167,8 +167,9 @@ tl_object_ptr<td_api::animation> AnimationsManager::get_animation_object(FileId
|
||||
|
||||
FileId AnimationsManager::on_get_animation(unique_ptr<Animation> new_animation, bool replace) {
|
||||
auto file_id = new_animation->file_id;
|
||||
LOG(INFO) << (replace ? "Replace" : "Add") << " animation " << file_id << " of size " << new_animation->dimensions;
|
||||
auto &a = animations_[file_id];
|
||||
LOG(INFO) << (a == nullptr ? "Add" : (replace ? "Replace" : "Ignore")) << " animation " << file_id << " of size "
|
||||
<< new_animation->dimensions;
|
||||
if (a == nullptr) {
|
||||
a = std::move(new_animation);
|
||||
} else if (replace) {
|
||||
@ -644,7 +645,13 @@ void AnimationsManager::add_saved_animation_by_id(FileId animation_id) {
|
||||
bool AnimationsManager::add_saved_animation_impl(FileId animation_id, Promise<Unit> &promise) {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
|
||||
LOG(INFO) << "Add saved animation " << animation_id;
|
||||
auto file_view = td_->file_manager_->get_file_view(animation_id);
|
||||
if (file_view.empty()) {
|
||||
promise.set_error(Status::Error(7, "Animation file not found"));
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG(INFO) << "Add saved animation " << animation_id << " with main file " << file_view.file_id();
|
||||
if (!are_saved_animations_loaded_) {
|
||||
load_saved_animations(PromiseCreator::lambda([animation_id, promise = std::move(promise)](Result<> result) mutable {
|
||||
if (result.is_ok()) {
|
||||
@ -677,7 +684,6 @@ bool AnimationsManager::add_saved_animation_impl(FileId animation_id, Promise<Un
|
||||
return false;
|
||||
}
|
||||
|
||||
auto file_view = td_->file_manager_->get_file_view(animation_id);
|
||||
if (!file_view.has_remote_location()) {
|
||||
promise.set_error(Status::Error(7, "Can save only sent animations"));
|
||||
return false;
|
||||
|
@ -1725,6 +1725,8 @@ Result<InputMessageContent> get_input_message_content(
|
||||
DialogId dialog_id, tl_object_ptr<td_api::InputMessageContent> &&input_message_content, Td *td) {
|
||||
bool is_secret = dialog_id.get_type() == DialogType::SecretChat;
|
||||
|
||||
LOG(INFO) << "Get input message content from " << to_string(input_message_content);
|
||||
|
||||
bool have_file = true;
|
||||
// TODO: send from secret chat to common
|
||||
Result<FileId> r_file_id = Status::Error(500, "Have no file");
|
||||
|
@ -2574,7 +2574,7 @@ Result<FileId> FileManager::check_input_file_id(FileType type, Result<FileId> re
|
||||
// But it will not be duped if has_input_media(), so for now we can't return main_file_id
|
||||
return dup_file_id(file_id);
|
||||
}
|
||||
return file_node->main_file_id_;
|
||||
return FileId(file_node->main_file_id_.get(), file_id.get_remote());
|
||||
}
|
||||
|
||||
Result<FileId> FileManager::get_input_thumbnail_file_id(const tl_object_ptr<td_api::InputFile> &thumbnail_input_file,
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <cstring>
|
||||
|
||||
namespace td {
|
||||
|
||||
StringBuilder &operator<<(StringBuilder &sb, const JsonRawString &val) {
|
||||
sb << '"';
|
||||
SCOPE_EXIT {
|
||||
@ -133,6 +134,7 @@ StringBuilder &operator<<(StringBuilder &sb, const JsonString &val) {
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
Result<MutableSlice> json_string_decode(Parser &parser) {
|
||||
if (!parser.try_skip('"')) {
|
||||
return Status::Error("Opening '\"' expected");
|
||||
|
Reference in New Issue
Block a user