From d479442a63963154dbc82511dcad5698410bafb6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 4 Jul 2019 11:04:12 +0200 Subject: [PATCH] Fix local thumbnail saving for stickers. --- Telegram/SourceFiles/data/data_session.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index c32ae05ef..c0bf619ac 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -2328,15 +2328,20 @@ not_null Session::processDocument( case mtpc_document: { const auto &fields = data.c_document(); + const auto mime = qs(fields.vmime_type); + const auto format = (mime == qstr("image/webp") + || mime == qstr("application/x-tgsticker")) + ? "WEBP" + : "JPG"; return document( fields.vid.v, fields.vaccess_hash.v, fields.vfile_reference.v, fields.vdate.v, fields.vattributes.v, - qs(fields.vmime_type), + mime, ImagePtr(), - Images::Create(std::move(thumb), "JPG"), + Images::Create(std::move(thumb), format), fields.vdc_id.v, fields.vsize.v, StorageImageLocation());