[geary/wip/765516-gtk-widget-conversation-viewer: 115/174] Fix some inline parts not being visible.



commit 2654df9697be25bb7fe70d54cdc23df13e429de2
Author: Michael James Gratton <mike vee net>
Date:   Sun Aug 14 11:08:26 2016 +1000

    Fix some inline parts not being visible.
    
    * src/client/conversation-viewer/conversation-email.vala
      (load_attachments): Check for attachment and inline elements that have
      not been included inline and add them as attachments.
    
    * src/engine/rfc822/rfc822-message.vala (construct_body_from_mime_parts):
      Only pass parts marked as inline to the inline replacer.

 .../conversation-viewer/conversation-email.vala    |   21 +++++++++++++++---
 src/engine/rfc822/rfc822-message.vala              |   22 ++++++++++---------
 2 files changed, 29 insertions(+), 14 deletions(-)
---
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index 9de4220..ad2ad95 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -623,10 +623,23 @@ public class ConversationEmail : Gtk.Box {
     private async void load_attachments(Cancellable load_cancelled) {
         // Do we have any attachments to be displayed?
         foreach (Geary.Attachment attachment in email.attachments) {
-            if (!(attachment.content_id in inlined_content_ids) &&
-                attachment.content_disposition.disposition_type ==
-                    Geary.Mime.DispositionType.ATTACHMENT) {
-                displayed_attachments.add(new AttachmentInfo(attachment));
+            if (!(attachment.content_id in inlined_content_ids)) {
+                Geary.Mime.DispositionType? disposition = null;
+                if (attachment.content_disposition != null) {
+                    disposition = attachment.content_disposition.disposition_type;
+                }
+                // Display both any attachment and inline parts that
+                // have already not been inlined. Although any inline
+                // parts should be referred to by other content in a
+                // multipart/related or multipart/alternative
+                // container, or inlined if in a multipart/mixed
+                // container, this cannot be not guaranteed. C.f. Bug
+                // 769868.
+                if (disposition != null &&
+                    disposition == Geary.Mime.DispositionType.ATTACHMENT ||
+                    disposition == Geary.Mime.DispositionType.INLINE) {
+                    displayed_attachments.add(new AttachmentInfo(attachment));
+                }
             }
         }
 
diff --git a/src/engine/rfc822/rfc822-message.vala b/src/engine/rfc822/rfc822-message.vala
index 2c9a645..63a9ee4 100644
--- a/src/engine/rfc822/rfc822-message.vala
+++ b/src/engine/rfc822/rfc822-message.vala
@@ -603,17 +603,19 @@ public class Geary.RFC822.Message : BaseObject {
             return false;
         }
 
-        // If images have no disposition, they are handled elsewhere; See Bug 713546
-        if (disposition == null || disposition.disposition_type == Mime.DispositionType.UNSPECIFIED)
-            return false;
-
-        // Use inline part replacer *only* if in a mixed multipart where each element is to be
-        // presented to the user as structure dictates; for alternative and related, the inline
-        // part is referred to elsewhere in the document and it's the callers responsibility to
-        // locate them
-        if (replacer != null && container_subtype == Mime.MultipartSubtype.MIXED) {
+        // Use inline part replacer *only* for inline parts and if in
+        // a mixed multipart where each element is to be presented to
+        // the user as structure dictates; For alternative and
+        // related, the inline part is referred to elsewhere in the
+        // document and it's the callers responsibility to locate them
+        if (replacer != null && disposition != null &&
+            disposition.disposition_type == Mime.DispositionType.INLINE &&
+            container_subtype == Mime.MultipartSubtype.MIXED) {
             body = replacer(RFC822.Utils.get_clean_attachment_filename(part),
-                            this_content_type, disposition, part.get_content_id(), 
mime_part_to_memory_buffer(part));
+                            this_content_type,
+                            disposition,
+                            part.get_content_id(),
+                            mime_part_to_memory_buffer(part));
         }
 
         return body != null;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]