From ce1b94eb169bef3b0f90ec9397ebee602e28a998 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 5 Feb 2021 13:17:26 +0400 Subject: [PATCH] Send PDFs only as files. Fixes #10294. --- Telegram/SourceFiles/storage/localimageloader.cpp | 3 ++- Telegram/SourceFiles/storage/storage_media_prepare.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index bad70f0a6f..81038b9365 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -875,7 +875,8 @@ void FileLoadTask::process(Args &&args) { } } else if (isAnimation) { attributes.push_back(MTP_documentAttributeAnimated()); - } else if (_type != SendMediaType::File) { + } else if (filemime.startsWith(u"image/"_q) + && _type != SendMediaType::File) { auto medium = (w > 320 || h > 320) ? fullimage.scaled(320, 320, Qt::KeepAspectRatio, Qt::SmoothTransformation) : fullimage; auto full = (w > 1280 || h > 1280) ? fullimage.scaled(1280, 1280, Qt::KeepAspectRatio, Qt::SmoothTransformation) : fullimage; { diff --git a/Telegram/SourceFiles/storage/storage_media_prepare.cpp b/Telegram/SourceFiles/storage/storage_media_prepare.cpp index 23955072b1..b08b4d77db 100644 --- a/Telegram/SourceFiles/storage/storage_media_prepare.cpp +++ b/Telegram/SourceFiles/storage/storage_media_prepare.cpp @@ -40,7 +40,7 @@ bool ValidPhotoForAlbum( const QString &mime) { if (image.animated || Core::IsMimeSticker(mime) - || (mime == u"application/pdf"_q)) { + || !mime.startsWith(u"image/")) { return false; } const auto width = image.data.width();