mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 09:08:49 -05:00
Fixes issue 1225
This commit is contained in:
parent
6d84f199c5
commit
51b92aaf80
@ -1163,24 +1163,33 @@ public class ImapStore extends Store
|
||||
|
||||
if (fetchList.containsKey("BODY"))
|
||||
{
|
||||
int index = fetchList.getKeyIndex("BODY") + 2;
|
||||
|
||||
boolean partFound = false;
|
||||
Part part = null;
|
||||
for (Object o : fp)
|
||||
{
|
||||
if (o instanceof Part)
|
||||
{
|
||||
partFound = true;
|
||||
Part part = (Part) o;
|
||||
Object literal = fetchList.getLiteral(index);
|
||||
part = (Part) o;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int index = fetchList.getKeyIndex("BODY") + 2;
|
||||
Object literal = fetchList.getObject(index);
|
||||
|
||||
// Check if there's an origin octet
|
||||
if (literal instanceof String)
|
||||
{
|
||||
String originOctet = (String)literal;
|
||||
if (originOctet.startsWith("<"))
|
||||
{
|
||||
literal = fetchList.getObject(index + 1);
|
||||
}
|
||||
}
|
||||
|
||||
InputStream bodyStream;
|
||||
if (literal instanceof InputStream)
|
||||
{
|
||||
InputStream bodyStream = (InputStream)literal;
|
||||
String contentTransferEncoding = part.getHeader(
|
||||
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
||||
part.setBody(MimeUtility.decodeBody(
|
||||
bodyStream,
|
||||
contentTransferEncoding));
|
||||
bodyStream = (InputStream)literal;
|
||||
}
|
||||
else if (literal instanceof String)
|
||||
{
|
||||
@ -1189,18 +1198,22 @@ public class ImapStore extends Store
|
||||
if (K9.DEBUG)
|
||||
Log.v(K9.LOG_TAG, "Part is a String: '" + bodyString + "' for " + getLogId());
|
||||
|
||||
InputStream bodyStream = new ByteArrayInputStream(bodyString.getBytes());
|
||||
bodyStream = new ByteArrayInputStream(bodyString.getBytes());
|
||||
}
|
||||
else
|
||||
{
|
||||
// This shouldn't happen
|
||||
throw new MessagingException("Got FETCH response with bogus parameters");
|
||||
}
|
||||
|
||||
if (part != null)
|
||||
{
|
||||
String contentTransferEncoding = part.getHeader(
|
||||
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
||||
part.setBody(MimeUtility.decodeBody(
|
||||
bodyStream,
|
||||
contentTransferEncoding));
|
||||
part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!partFound)
|
||||
else
|
||||
{
|
||||
InputStream bodyStream = fetchList.getLiteral(index);
|
||||
imapMessage.parse(bodyStream);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user