mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 01:28:50 -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"))
|
if (fetchList.containsKey("BODY"))
|
||||||
{
|
{
|
||||||
int index = fetchList.getKeyIndex("BODY") + 2;
|
Part part = null;
|
||||||
|
|
||||||
boolean partFound = false;
|
|
||||||
for (Object o : fp)
|
for (Object o : fp)
|
||||||
{
|
{
|
||||||
if (o instanceof Part)
|
if (o instanceof Part)
|
||||||
{
|
{
|
||||||
partFound = true;
|
part = (Part) o;
|
||||||
Part part = (Part) o;
|
break;
|
||||||
Object literal = fetchList.getLiteral(index);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
if (literal instanceof InputStream)
|
||||||
{
|
{
|
||||||
InputStream bodyStream = (InputStream)literal;
|
bodyStream = (InputStream)literal;
|
||||||
String contentTransferEncoding = part.getHeader(
|
|
||||||
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
|
||||||
part.setBody(MimeUtility.decodeBody(
|
|
||||||
bodyStream,
|
|
||||||
contentTransferEncoding));
|
|
||||||
}
|
}
|
||||||
else if (literal instanceof String)
|
else if (literal instanceof String)
|
||||||
{
|
{
|
||||||
@ -1189,18 +1198,22 @@ public class ImapStore extends Store
|
|||||||
if (K9.DEBUG)
|
if (K9.DEBUG)
|
||||||
Log.v(K9.LOG_TAG, "Part is a String: '" + bodyString + "' for " + getLogId());
|
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(
|
String contentTransferEncoding = part.getHeader(
|
||||||
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0];
|
||||||
part.setBody(MimeUtility.decodeBody(
|
part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding));
|
||||||
bodyStream,
|
|
||||||
contentTransferEncoding));
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
|
||||||
if (!partFound)
|
|
||||||
{
|
{
|
||||||
InputStream bodyStream = fetchList.getLiteral(index);
|
|
||||||
imapMessage.parse(bodyStream);
|
imapMessage.parse(bodyStream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user