Merge "Don't bail out of downloading an attachment if the size is delcared as zero" into jb-ub-mail-ur10
This commit is contained in:
commit
164677131a
@ -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,9 +801,14 @@ class ImapFolder extends Folder {
|
||||
out.write(buffer, 0, n);
|
||||
count += n;
|
||||
if (listener != null) {
|
||||
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) {
|
||||
String warning = "\n\n" + MailActivityEmail.getMessageDecodeErrorString();
|
||||
out.write(warning.getBytes());
|
||||
|
Loading…
Reference in New Issue
Block a user