diff options
author | Tony Mantler <nicoya@google.com> | 2014-02-21 11:14:48 -0800 |
---|---|---|
committer | Tony Mantler <nicoya@google.com> | 2014-02-21 11:16:29 -0800 |
commit | 16fea4dfc0707a7b95debaeb1a9cc93fe336f1bc (patch) | |
tree | 1e04a156a0f1ad16418b27fc4b971fbf762262e2 | |
parent | 5f72d21df95311bb3cb11a931b2371634bdd5a04 (diff) | |
download | android_packages_apps_Email-16fea4dfc0707a7b95debaeb1a9cc93fe336f1bc.tar.gz android_packages_apps_Email-16fea4dfc0707a7b95debaeb1a9cc93fe336f1bc.tar.bz2 android_packages_apps_Email-16fea4dfc0707a7b95debaeb1a9cc93fe336f1bc.zip |
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
-rw-r--r-- | src/com/android/email/LegacyConversions.java | 13 | ||||
-rw-r--r-- | src/com/android/email/provider/Utilities.java | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/com/android/email/LegacyConversions.java b/src/com/android/email/LegacyConversions.java index eba35ba86..2c5d2ae17 100644 --- a/src/com/android/email/LegacyConversions.java +++ b/src/com/android/email/LegacyConversions.java @@ -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 * diff --git a/src/com/android/email/provider/Utilities.java b/src/com/android/email/provider/Utilities.java index d66f73db4..b88dc1b03 100644 --- a/src/com/android/email/provider/Utilities.java +++ b/src/com/android/email/provider/Utilities.java @@ -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 |