From 28a35c25f18dc27bcfa1911323e5970046143251 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 20 Aug 2023 22:10:13 +0200 Subject: [PATCH] Fixed deleting message/rfc822 attachments --- app/src/main/java/eu/faircode/email/Core.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index cc2d190528..f7c4172b80 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -126,6 +126,7 @@ import javax.mail.Store; import javax.mail.StoreClosedException; import javax.mail.UIDFolder; import javax.mail.internet.AddressException; +import javax.mail.internet.ContentType; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; @@ -2170,6 +2171,15 @@ class Core { multipart.removeBodyPart(i); + try { + // Can't upload empty message/rfc822 + ContentType ct = new ContentType(contentType); + if ("message/rfc822".equalsIgnoreCase(ct.getBaseType())) + contentType = "application/octet-stream"; + } catch (Throwable ex) { + Log.w(ex); + } + BodyPart placeholderPart = new MimeBodyPart(); placeholderPart.setContent("", contentType); placeholderPart.setFileName(fileName);