2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Moved searching of sticker mimes to single place.

This commit is contained in:
23rd
2020-01-07 13:41:13 +03:00
committed by John Preston
parent f3595e379c
commit d1d5312ead
7 changed files with 17 additions and 20 deletions

View File

@@ -656,9 +656,6 @@ bool FileLoadTask::FillImageInformation(
}
void FileLoadTask::process() {
const auto stickerMime = qsl("image/webp");
const auto animatedStickerMime = qsl("application/x-tgsticker");
_result = std::make_shared<FileLoadResult>(
id(),
_id,
@@ -700,7 +697,7 @@ void FileLoadTask::process() {
if (auto image = base::get_if<FileMediaInformation::Image>(
&_information->media)) {
fullimage = base::take(image->data);
if (filemime != stickerMime && filemime != animatedStickerMime) {
if (!Core::IsMimeSticker(filemime)) {
fullimage = Images::prepareOpaque(std::move(fullimage));
}
isAnimation = image->animated;
@@ -719,7 +716,7 @@ void FileLoadTask::process() {
}
const auto mimeType = Core::MimeTypeForData(_content);
filemime = mimeType.name();
if (filemime != stickerMime && filemime != animatedStickerMime) {
if (!Core::IsMimeSticker(filemime)) {
fullimage = Images::prepareOpaque(std::move(fullimage));
}
if (filemime == "image/jpeg") {
@@ -831,8 +828,7 @@ void FileLoadTask::process() {
attributes.push_back(MTP_documentAttributeImageSize(MTP_int(w), MTP_int(h)));
if (ValidateThumbDimensions(w, h)) {
isSticker = (filemime == stickerMime
|| filemime == animatedStickerMime)
isSticker = Core::IsMimeSticker(filemime)
&& (w > 0)
&& (h > 0)
&& (w <= StickerMaxSize)