Fix file list hash calculation.
GitOrigin-RevId: e39474ebdc128079f65a4e2d97ecc4b0a8419c22
This commit is contained in:
parent
fce5219334
commit
032aed823a
@ -124,7 +124,7 @@ tl_object_ptr<td_api::animation> AnimationsManager::get_animation_object(FileId
|
||||
return make_tl_object<td_api::animation>(animation->duration, animation->dimensions.width,
|
||||
animation->dimensions.height, animation->file_name, animation->mime_type,
|
||||
get_photo_size_object(td_->file_manager_.get(), &animation->thumbnail),
|
||||
td_->file_manager_->get_file_object(animation->file_id));
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
FileId AnimationsManager::on_get_animation(std::unique_ptr<Animation> new_animation, bool replace) {
|
||||
@ -512,7 +512,7 @@ int32 AnimationsManager::get_saved_animations_hash() const {
|
||||
for (auto animation_id : saved_animation_ids_) {
|
||||
auto animation = get_animation(animation_id);
|
||||
CHECK(animation != nullptr);
|
||||
auto file_view = td_->file_manager_->get_file_view(animation->file_id);
|
||||
auto file_view = td_->file_manager_->get_file_view(animation_id);
|
||||
CHECK(file_view.has_remote_location());
|
||||
CHECK(!file_view.remote_location().is_encrypted());
|
||||
CHECK(!file_view.remote_location().is_web());
|
||||
|
@ -43,7 +43,7 @@ tl_object_ptr<td_api::audio> AudiosManager::get_audio_object(FileId file_id) {
|
||||
return make_tl_object<td_api::audio>(audio->duration, audio->title, audio->performer, audio->file_name,
|
||||
audio->mime_type,
|
||||
get_photo_size_object(td_->file_manager_.get(), &audio->thumbnail),
|
||||
td_->file_manager_->get_file_object(audio->file_id));
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
FileId AudiosManager::on_get_audio(std::unique_ptr<Audio> new_audio, bool replace) {
|
||||
|
@ -54,7 +54,7 @@ tl_object_ptr<td_api::document> DocumentsManager::get_document_object(FileId fil
|
||||
document->is_changed = false;
|
||||
return make_tl_object<td_api::document>(document->file_name, document->mime_type,
|
||||
get_photo_size_object(td_->file_manager_.get(), &document->thumbnail),
|
||||
td_->file_manager_->get_file_object(document->file_id));
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
std::pair<DocumentsManager::DocumentType, FileId> DocumentsManager::on_get_document(
|
||||
|
@ -802,7 +802,7 @@ tl_object_ptr<td_api::sticker> StickersManager::get_sticker_object(FileId file_i
|
||||
return make_tl_object<td_api::sticker>(sticker->set_id, sticker->dimensions.width, sticker->dimensions.height,
|
||||
sticker->alt, sticker->is_mask, std::move(mask_position),
|
||||
get_photo_size_object(td_->file_manager_.get(), &thumbnail),
|
||||
td_->file_manager_->get_file_object(sticker->file_id));
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
tl_object_ptr<td_api::stickers> StickersManager::get_stickers_object(const vector<FileId> &sticker_ids) {
|
||||
@ -3452,7 +3452,7 @@ int32 StickersManager::get_recent_stickers_hash(const vector<FileId> &sticker_id
|
||||
for (auto sticker_id : sticker_ids) {
|
||||
auto sticker = get_sticker(sticker_id);
|
||||
CHECK(sticker != nullptr);
|
||||
auto file_view = td_->file_manager_->get_file_view(sticker->file_id);
|
||||
auto file_view = td_->file_manager_->get_file_view(sticker_id);
|
||||
CHECK(file_view.has_remote_location());
|
||||
CHECK(!file_view.remote_location().is_encrypted());
|
||||
CHECK(!file_view.remote_location().is_web());
|
||||
|
@ -43,7 +43,7 @@ tl_object_ptr<td_api::videoNote> VideoNotesManager::get_video_note_object(FileId
|
||||
|
||||
return make_tl_object<td_api::videoNote>(video_note->duration, video_note->dimensions.width,
|
||||
get_photo_size_object(td_->file_manager_.get(), &video_note->thumbnail),
|
||||
td_->file_manager_->get_file_object(video_note->file_id));
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
FileId VideoNotesManager::on_get_video_note(std::unique_ptr<VideoNote> new_video_note, bool replace) {
|
||||
|
@ -46,7 +46,7 @@ tl_object_ptr<td_api::video> VideosManager::get_video_object(FileId file_id) {
|
||||
video->file_name, video->mime_type, video->has_stickers,
|
||||
video->supports_streaming,
|
||||
get_photo_size_object(td_->file_manager_.get(), &video->thumbnail),
|
||||
td_->file_manager_->get_file_object(video->file_id));
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
FileId VideosManager::on_get_video(std::unique_ptr<Video> new_video, bool replace) {
|
||||
|
@ -42,7 +42,7 @@ tl_object_ptr<td_api::voiceNote> VoiceNotesManager::get_voice_note_object(FileId
|
||||
CHECK(voice_note != nullptr);
|
||||
voice_note->is_changed = false;
|
||||
return make_tl_object<td_api::voiceNote>(voice_note->duration, voice_note->waveform, voice_note->mime_type,
|
||||
td_->file_manager_->get_file_object(voice_note->file_id));
|
||||
td_->file_manager_->get_file_object(file_id));
|
||||
}
|
||||
|
||||
FileId VoiceNotesManager::on_get_voice_note(std::unique_ptr<VoiceNote> new_voice_note, bool replace) {
|
||||
|
@ -66,14 +66,12 @@ Result<FileLoader::FileInfo> FileDownloader::init() {
|
||||
ready_part_count = partial.ready_part_count_;
|
||||
}
|
||||
}
|
||||
LOG(ERROR) << search_file_ << " " << size_;
|
||||
if (search_file_ && fd_.empty() && size_ > 0 && size_ < 1000 * (1 << 20) && encryption_key_.empty() &&
|
||||
!remote_.is_web()) {
|
||||
[&] {
|
||||
TRY_RESULT(path, search_file(get_files_dir(remote_.file_type_), name_, size_));
|
||||
TRY_RESULT(fd, FileFd::open(path, FileFd::Read));
|
||||
LOG(INFO) << "Check hash of local file " << path;
|
||||
LOG(ERROR) << "Check hash of local file " << path;
|
||||
path_ = std::move(path);
|
||||
fd_ = std::move(fd);
|
||||
need_check_ = true;
|
||||
|
@ -63,6 +63,6 @@ struct FileIdHash {
|
||||
};
|
||||
|
||||
inline StringBuilder &operator<<(StringBuilder &string_builder, FileId file_id) {
|
||||
return string_builder << file_id.get();
|
||||
return string_builder << file_id.get() << "(" << file_id.get_remote() << ")";
|
||||
}
|
||||
} // namespace td
|
||||
|
@ -745,7 +745,6 @@ Result<FileId> FileManager::register_file(FileData data, FileLocationSource file
|
||||
if (file_view.has_remote_location()) {
|
||||
RemoteInfo info{file_view.remote_location(), file_id, file_location_source};
|
||||
remote_key = remote_location_info_.add(info);
|
||||
CHECK(remote_key < 1000);
|
||||
auto &stored_info = remote_location_info_.get(remote_key);
|
||||
if (stored_info.file_id == file_id) {
|
||||
get_file_id_info(file_id)->pin_flag_ = true;
|
||||
|
Loading…
Reference in New Issue
Block a user