From c97227825f2e3cfc9c3c316e29a3f40b4b676f84 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 17 Aug 2017 12:45:23 +0300 Subject: [PATCH] Send images as files if no way to send as photos. Fixes #3710. --- Telegram/SourceFiles/storage/localimageloader.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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)));