diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index fbb2ecc85f..4a1e01340f 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -422,9 +422,9 @@ void FileLoadTask::process() { QVector attributes(1, MTP_documentAttributeFilename(MTP_string(filename))); - MTPPhotoSize thumbSize(MTP_photoSizeEmpty(MTP_string(""))); - MTPPhoto photo(MTP_photoEmpty(MTP_long(0))); - MTPDocument document(MTP_documentEmpty(MTP_long(0))); + auto thumbSize = MTP_photoSizeEmpty(MTP_string("")); + auto photo = MTP_photoEmpty(MTP_long(0)); + auto document = MTP_documentEmpty(MTP_long(0)); if (!isVoice) { if (!_information) { @@ -540,6 +540,10 @@ void FileLoadTask::process() { } } + if (_type == SendMediaType::Photo && photo.type() == mtpc_photoEmpty) { + _type = SendMediaType::File; + } + if (isVoice) { auto flags = MTPDdocumentAttributeAudio::Flag::f_voice | MTPDdocumentAttributeAudio::Flag::f_waveform; attributes[0] = MTP_documentAttributeAudio(MTP_flags(flags), MTP_int(_duration), MTPstring(), MTPstring(), MTP_bytes(documentWaveformEncode5bit(_waveform)));