Quit dropping inline attachments on the floor
If we have image/* attachments with "Content-Disposition: inline" we would fetch the images immediately, then drop them on the floor instead of saving them to the DB. Add code to catch these attachments and save them. b/13132802 Change-Id: I5203bb1aa518aa46cdb3a38ead6f79af63b521ac
This commit is contained in:
parent
5f72d21df9
commit
16fea4dfc0
|
@ -21,6 +21,7 @@ import android.content.ContentValues;
|
|||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.emailcommon.Logging;
|
||||
import com.android.emailcommon.internet.MimeBodyPart;
|
||||
|
@ -170,6 +171,18 @@ public class LegacyConversions {
|
|||
}
|
||||
}
|
||||
|
||||
public static void updateInlineAttachments(Context context, EmailContent.Message localMessage,
|
||||
ArrayList<Part> inlineAttachments) throws MessagingException, IOException {
|
||||
for (final Part inlinePart : inlineAttachments) {
|
||||
final String disposition = MimeUtility.getHeaderParameter(
|
||||
MimeUtility.unfoldAndDecode(inlinePart.getDisposition()), null);
|
||||
if (!TextUtils.isEmpty(disposition)) {
|
||||
// Treat inline parts as attachments
|
||||
addOneAttachment(context, localMessage, inlinePart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a single attachment part to the message
|
||||
*
|
||||
|
|
|
@ -137,6 +137,7 @@ public class Utilities {
|
|||
&& loadStatus != EmailContent.Message.FLAG_LOADED_UNKNOWN) {
|
||||
// TODO(pwestbro): What should happen with unknown status?
|
||||
LegacyConversions.updateAttachments(context, localMessage, attachments);
|
||||
LegacyConversions.updateInlineAttachments(context, localMessage, viewables);
|
||||
} else {
|
||||
EmailContent.Attachment att = new EmailContent.Attachment();
|
||||
// Since we haven't actually loaded the attachment, we're just putting
|
||||
|
|
Loading…
Reference in New Issue