mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-04 02:28:18 +00:00
Attempt to workaround "Unable to load BODYSTRUCTURE"
This commit is contained in:
parent
cbe2cf560f
commit
d85738286d
1 changed files with 22 additions and 1 deletions
|
@ -752,7 +752,25 @@ public class MessageHelper {
|
|||
|
||||
MessageParts getMessageParts() throws IOException, FolderClosedException {
|
||||
MessageParts parts = new MessageParts();
|
||||
getMessageParts(imessage, parts, false); // Can throw ParseException
|
||||
|
||||
MimeMessage cmessage = imessage;
|
||||
try {
|
||||
// Load body structure
|
||||
cmessage.getContentID();
|
||||
} catch (MessagingException ex) {
|
||||
// https://javaee.github.io/javamail/FAQ#imapserverbug
|
||||
if ("Unable to load BODYSTRUCTURE".equals(ex.getMessage())) {
|
||||
Log.w(ex);
|
||||
parts.warnings.add(Helper.formatThrowable(ex));
|
||||
try {
|
||||
cmessage = new MimeMessage(imessage);
|
||||
} catch (MessagingException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getMessageParts(cmessage, parts, false);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
|
@ -771,6 +789,7 @@ public class MessageHelper {
|
|||
// Nested body: try to continue
|
||||
// ParseException: In parameter list boundary="...">, expected parameter name, got ";"
|
||||
Log.w(ex);
|
||||
parts.warnings.add(Helper.formatThrowable(ex));
|
||||
}
|
||||
} else {
|
||||
// https://www.iana.org/assignments/cont-disp/cont-disp.xhtml
|
||||
|
@ -779,6 +798,7 @@ public class MessageHelper {
|
|||
disposition = part.getDisposition();
|
||||
} catch (MessagingException ex) {
|
||||
Log.w(ex);
|
||||
parts.warnings.add(Helper.formatThrowable(ex));
|
||||
disposition = null;
|
||||
}
|
||||
|
||||
|
@ -787,6 +807,7 @@ public class MessageHelper {
|
|||
filename = part.getFileName();
|
||||
} catch (MessagingException ex) {
|
||||
Log.w(ex);
|
||||
parts.warnings.add(Helper.formatThrowable(ex));
|
||||
filename = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue