Поправил обработку изображений
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
Struchkov Mark 2023-11-27 15:49:14 +03:00
parent 3eeb78b42a
commit 35556762f0
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6

View File

@ -15,6 +15,7 @@ import dev.struchkov.godfather.telegram.domain.attachment.VoiceAttachment;
import dev.struchkov.godfather.telegram.main.context.MailPayload; import dev.struchkov.godfather.telegram.main.context.MailPayload;
import dev.struchkov.haiti.utils.Checker; import dev.struchkov.haiti.utils.Checker;
import dev.struchkov.haiti.utils.Strings; import dev.struchkov.haiti.utils.Strings;
import org.glassfish.grizzly.http.util.MimeType;
import org.telegram.telegrambots.meta.api.objects.Chat; import org.telegram.telegrambots.meta.api.objects.Chat;
import org.telegram.telegrambots.meta.api.objects.Contact; import org.telegram.telegrambots.meta.api.objects.Contact;
import org.telegram.telegrambots.meta.api.objects.Document; import org.telegram.telegrambots.meta.api.objects.Document;
@ -109,6 +110,8 @@ public final class MessageMailConvert {
picture.setFileId(photoSize.getFileId()); picture.setFileId(photoSize.getFileId());
picture.setHeight(photoSize.getHeight()); picture.setHeight(photoSize.getHeight());
picture.setWeight(photoSize.getWidth()); picture.setWeight(photoSize.getWidth());
picture.setMimeType("image/jpeg");
picture.setFileName(generateFileName("image/jpeg"));
return picture; return picture;
}).toList(); }).toList();
@ -181,7 +184,7 @@ public final class MessageMailConvert {
switch (mimeType) { switch (mimeType) {
case "audio/ogg" -> builder.append(".ogg"); case "audio/ogg" -> builder.append(".ogg");
case "image/png" -> builder.append(".png"); case "image/png" -> builder.append(".png");
case "image/jpeg" -> builder.append(".jpeg"); case "image/jpeg" -> builder.append(".jpg");
default -> {} default -> {}
} }
return builder.toString(); return builder.toString();