Fix sending secure files to secret chats.

GitOrigin-RevId: e5cafeb4d3e48c3b5c925c81dd3406d8b0ce44da
This commit is contained in:
levlam 2018-06-08 22:23:49 +03:00
parent ea8d5dbda7
commit 54e1a4f100
7 changed files with 8 additions and 8 deletions

View File

@ -308,7 +308,7 @@ SecretInputMedia AnimationsManager::get_secret_input_media(FileId animation_file
CHECK(animation != nullptr);
auto file_view = td_->file_manager_->get_file_view(animation_file_id);
auto &encryption_key = file_view.encryption_key();
if (encryption_key.empty()) {
if (!file_view.is_encrypted_secret() || encryption_key.empty()) {
return SecretInputMedia{};
}
if (file_view.has_remote_location()) {

View File

@ -187,7 +187,7 @@ SecretInputMedia AudiosManager::get_secret_input_media(FileId audio_file_id,
CHECK(audio != nullptr);
auto file_view = td_->file_manager_->get_file_view(audio_file_id);
auto &encryption_key = file_view.encryption_key();
if (encryption_key.empty()) {
if (!file_view.is_encrypted_secret() || encryption_key.empty()) {
return SecretInputMedia{};
}
if (file_view.has_remote_location()) {

View File

@ -426,7 +426,7 @@ const DocumentsManager::Document *DocumentsManager::get_document(FileId file_id)
bool DocumentsManager::has_input_media(FileId file_id, FileId thumbnail_file_id, bool is_secret) const {
auto file_view = td_->file_manager_->get_file_view(file_id);
if (is_secret) {
if (file_view.encryption_key().empty() || !file_view.has_remote_location()) {
if (!file_view.is_encrypted_secret() || file_view.encryption_key().empty() || !file_view.has_remote_location()) {
return false;
}
@ -446,7 +446,7 @@ SecretInputMedia DocumentsManager::get_secret_input_media(FileId document_file_i
CHECK(document != nullptr);
auto file_view = td_->file_manager_->get_file_view(document_file_id);
auto &encryption_key = file_view.encryption_key();
if (encryption_key.empty()) {
if (!file_view.is_encrypted_secret() || encryption_key.empty()) {
return SecretInputMedia{};
}
if (file_view.has_remote_location()) {

View File

@ -595,7 +595,7 @@ SecretInputMedia photo_get_secret_input_media(FileManager *file_manager, const P
}
auto file_view = file_manager->get_file_view(file_id);
auto &encryption_key = file_view.encryption_key();
if (encryption_key.empty()) {
if (!file_view.is_encrypted_secret() || encryption_key.empty()) {
return {};
}
if (file_view.has_remote_location()) {

View File

@ -166,7 +166,7 @@ SecretInputMedia VideoNotesManager::get_secret_input_media(FileId video_note_fil
CHECK(video_note != nullptr);
auto file_view = td_->file_manager_->get_file_view(video_note_file_id);
auto &encryption_key = file_view.encryption_key();
if (encryption_key.empty()) {
if (!file_view.is_encrypted_secret() || encryption_key.empty()) {
return SecretInputMedia{};
}
if (file_view.has_remote_location()) {

View File

@ -195,7 +195,7 @@ SecretInputMedia VideosManager::get_secret_input_media(FileId video_file_id,
CHECK(video != nullptr);
auto file_view = td_->file_manager_->get_file_view(video_file_id);
auto &encryption_key = file_view.encryption_key();
if (encryption_key.empty()) {
if (!file_view.is_encrypted_secret() || encryption_key.empty()) {
return SecretInputMedia{};
}
if (file_view.has_remote_location()) {

View File

@ -146,7 +146,7 @@ SecretInputMedia VoiceNotesManager::get_secret_input_media(FileId voice_file_id,
CHECK(voice_note != nullptr);
auto file_view = td_->file_manager_->get_file_view(voice_file_id);
auto &encryption_key = file_view.encryption_key();
if (encryption_key.empty()) {
if (!file_view.is_encrypted_secret() || encryption_key.empty()) {
return SecretInputMedia{};
}
if (file_view.has_remote_location()) {