mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 15:47:11 +02:00
Fix animated stickers with wrong dimensions.
This commit is contained in:
parent
f64f1ea62e
commit
9463bbd266
5 changed files with 20 additions and 11 deletions
|
@ -102,9 +102,13 @@ MimeType MimeTypeForData(const QByteArray &data) {
|
|||
return MimeType(QMimeDatabase().mimeTypeForData(data));
|
||||
}
|
||||
|
||||
bool IsMimeStickerAnimated(const QString &mime) {
|
||||
return mime == qsl("application/x-tgsticker");
|
||||
}
|
||||
|
||||
bool IsMimeSticker(const QString &mime) {
|
||||
return mime == qsl("image/webp")
|
||||
|| mime == qsl("application/x-tgsticker");
|
||||
|| IsMimeStickerAnimated(mime);
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -39,6 +39,7 @@ MimeType MimeTypeForName(const QString &mime);
|
|||
MimeType MimeTypeForFile(const QFileInfo &file);
|
||||
MimeType MimeTypeForData(const QByteArray &data);
|
||||
|
||||
bool IsMimeStickerAnimated(const QString &mime);
|
||||
bool IsMimeSticker(const QString &mime);
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -573,8 +573,11 @@ void DocumentData::setattributes(
|
|||
});
|
||||
}
|
||||
if (type == StickerDocument
|
||||
&& (!GoodStickerDimensions(dimensions.width(), dimensions.height())
|
||||
|| (size > Storage::kMaxStickerBytesSize))) {
|
||||
&& ((size > Storage::kMaxStickerBytesSize)
|
||||
|| (!sticker()->animated
|
||||
&& !GoodStickerDimensions(
|
||||
dimensions.width(),
|
||||
dimensions.height())))) {
|
||||
type = FileDocument;
|
||||
_additional = nullptr;
|
||||
}
|
||||
|
|
|
@ -82,12 +82,12 @@ using BigNumContext = openssl::Context;
|
|||
Z(32);
|
||||
S(qstr("\x20"));
|
||||
R(32);
|
||||
S(qstr("\x00\x22"));
|
||||
S(qstr("\x00\x20"));
|
||||
G(0);
|
||||
S(qstr(""
|
||||
"\x13\x01\x13\x02\x13\x03\xc0\x2b\xc0\x2f\xc0\x2c\xc0\x30\xcc\xa9"
|
||||
"\xcc\xa8\xc0\x13\xc0\x14\x00\x9c\x00\x9d\x00\x2f\x00\x35\x00\x0a"
|
||||
"\x01\x00\x01\x91"));
|
||||
"\xcc\xa8\xc0\x13\xc0\x14\x00\x9c\x00\x9d\x00\x2f\x00\x35\x01\x00"
|
||||
"\x01\x93"));
|
||||
G(2);
|
||||
S(qstr("\x00\x00\x00\x00"));
|
||||
Open();
|
||||
|
@ -103,9 +103,9 @@ using BigNumContext = openssl::Context;
|
|||
S(qstr(""
|
||||
"\x00\x1d\x00\x17\x00\x18\x00\x0b\x00\x02\x01\x00\x00\x23\x00\x00"
|
||||
"\x00\x10\x00\x0e\x00\x0c\x02\x68\x32\x08\x68\x74\x74\x70\x2f\x31"
|
||||
"\x2e\x31\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\x0d\x00\x14\x00"
|
||||
"\x12\x04\x03\x08\x04\x04\x01\x05\x03\x08\x05\x05\x01\x08\x06\x06"
|
||||
"\x01\x02\x01\x00\x12\x00\x00\x00\x33\x00\x2b\x00\x29"));
|
||||
"\x2e\x31\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\x0d\x00\x12\x00"
|
||||
"\x10\x04\x03\x08\x04\x04\x01\x05\x03\x08\x05\x05\x01\x08\x06\x06"
|
||||
"\x01\x00\x12\x00\x00\x00\x33\x00\x2b\x00\x29"));
|
||||
G(4);
|
||||
S(qstr("\x00\x01\x00\x00\x1d\x00\x20"));
|
||||
K();
|
||||
|
|
|
@ -842,8 +842,9 @@ void FileLoadTask::process() {
|
|||
|
||||
if (ValidateThumbDimensions(w, h)) {
|
||||
isSticker = Core::IsMimeSticker(filemime)
|
||||
&& GoodStickerDimensions(w, h)
|
||||
&& (filesize < Storage::kMaxStickerBytesSize);
|
||||
&& (filesize < Storage::kMaxStickerBytesSize)
|
||||
&& (Core::IsMimeStickerAnimated(filemime)
|
||||
|| GoodStickerDimensions(w, h));
|
||||
if (isSticker) {
|
||||
attributes.push_back(MTP_documentAttributeSticker(
|
||||
MTP_flags(0),
|
||||
|
|
Loading…
Add table
Reference in a new issue