Disabled edit media with gif files.

This commit is contained in:
23rd 2019-04-04 11:02:42 +03:00
parent 2cb69f0c2b
commit a9fa49e372
1 changed files with 7 additions and 6 deletions

View File

@ -400,14 +400,15 @@ void EditCaptionBox::createEditMediaButton() {
return; return;
} }
const auto isWebp = [](QString mimeType) { const auto isValidFile = [](QString mimeType) {
if (mimeType == qstr("image/webp")) { if (mimeType == qstr("image/webp")
|| mimeType == qstr("image/gif")) {
Ui::show( Ui::show(
Box<InformBox>(lang(lng_edit_media_invalid_file)), Box<InformBox>(lang(lng_edit_media_invalid_file)),
LayerOption::KeepOther); LayerOption::KeepOther);
return true; return false;
} }
return false; return true;
}; };
if (!result.remoteContent.isEmpty()) { if (!result.remoteContent.isEmpty()) {
@ -417,7 +418,7 @@ void EditCaptionBox::createEditMediaButton() {
std::move(result.remoteContent), std::move(result.remoteContent),
st::sendMediaPreviewSize); st::sendMediaPreviewSize);
if (isWebp(list.files.front().mime)) { if (!isValidFile(list.files.front().mime)) {
return; return;
} }
@ -464,7 +465,7 @@ void EditCaptionBox::createEditMediaButton() {
} }
} }
const auto info = QFileInfo(result.paths.front()); const auto info = QFileInfo(result.paths.front());
if (isWebp(Core::MimeTypeForFile(info).name())) { if (!isValidFile(Core::MimeTypeForFile(info).name())) {
return; return;
} }