Don't bail out of downloading an attachment if the size is delcared as zero

b/11225306

Change-Id: If67401dd3e6b652b03fba2e71cfc82fdae80ccb2
This commit is contained in:
Tony Mantler 2013-10-16 17:15:31 -07:00
parent 85d2190552
commit 4aaf3f2e33
1 changed files with 7 additions and 2 deletions

View File

@ -740,7 +740,7 @@ class ImapFolder extends Folder {
InputStream bodyStream = body.getAsStream();
message.parse(bodyStream);
}
if (fetchPart != null && fetchPart.getSize() > 0) {
if (fetchPart != null) {
InputStream bodyStream =
fetchList.getKeyedStringOrEmpty("BODY[", true).getAsStream();
String encodings[] = fetchPart.getHeader(
@ -801,7 +801,12 @@ class ImapFolder extends Folder {
out.write(buffer, 0, n);
count += n;
if (listener != null) {
listener.loadAttachmentProgress(count * 100 / size);
if (size == 0) {
// We don't know how big the file is, so just fake it.
listener.loadAttachmentProgress((int)Math.ceil(100 * (1-1.0/count)));
} else {
listener.loadAttachmentProgress(count * 100 / size);
}
}
}
} catch (Base64DataException bde) {