From f2b3d9714f3ea157b420780b7a6c845a42e3abd7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 15 Jul 2019 14:08:35 +0200 Subject: [PATCH] Fix sticker sending from clipboard. --- .../SourceFiles/storage/storage_media_prepare.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/storage/storage_media_prepare.cpp b/Telegram/SourceFiles/storage/storage_media_prepare.cpp index 1276e14cf..2e419429e 100644 --- a/Telegram/SourceFiles/storage/storage_media_prepare.cpp +++ b/Telegram/SourceFiles/storage/storage_media_prepare.cpp @@ -27,8 +27,12 @@ bool HasExtensionFrom(const QString &file, const QStringList &extensions) { return false; } -bool ValidPhotoForAlbum(const FileMediaInformation::Image &image) { - if (image.animated) { +bool ValidPhotoForAlbum( + const FileMediaInformation::Image &image, + const QString &mime) { + if (image.animated + || mime == qstr("image/webp") + || mime == qstr("application/x-tgsticker")) { return false; } const auto width = image.data.width(); @@ -79,7 +83,7 @@ bool PrepareAlbumMediaIsWaiting( using Video = FileMediaInformation::Video; if (const auto image = base::get_if( &file.information->media)) { - if (ValidPhotoForAlbum(*image)) { + if (ValidPhotoForAlbum(*image, file.mime)) { file.shownDimensions = PrepareShownDimensions(image->data); file.preview = Images::prepareOpaque(image->data.scaledToWidth( std::min(previewWidth, ConvertScale(image->data.width())) @@ -313,7 +317,7 @@ void PreparedList::mergeToEnd(PreparedList &&other) { bool PreparedList::canAddCaption(bool isAlbum, bool compressImages) const { const auto isSticker = [&] { - if (files.empty() || compressImages) { + if (files.empty()) { return false; } return (files.front().mime == qstr("image/webp"))