[evolution/gnome-3-28] Reply includes HTML attachment in message body



commit b7b0a1f9754e2396c9ce027601bce93e9d9c20fa
Author: Milan Crha <mcrha redhat com>
Date:   Thu Mar 29 14:41:18 2018 +0200

    Reply includes HTML attachment in message body
    
    Messages with HTML attachments could have added the first HTML
    attachment into the message body in forward/reply.
    
    This had been reported downstream:
    https://bugzilla.redhat.com/show_bug.cgi?id=1560567

 src/mail/em-utils.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/mail/em-utils.c b/src/mail/em-utils.c
index bab5a9c..0f604bd 100644
--- a/src/mail/em-utils.c
+++ b/src/mail/em-utils.c
@@ -1239,6 +1239,7 @@ em_utils_message_to_html (CamelSession *session,
        gsize n_bytes_written = 0;
        GQueue queue = G_QUEUE_INIT;
        GList *head, *link;
+       gboolean found_text_part = FALSE;
        gchar *data;
 
        shell = e_shell_get_default ();
@@ -1283,13 +1284,20 @@ em_utils_message_to_html (CamelSession *session,
 
                /* prefer-plain can hide HTML parts, even when it's the only
                 * text part in the email, thus show it (and hide again later) */
-               if (part->is_hidden && !hidden_text_html_part &&
+               if (!found_text_part && !hidden_text_html_part &&
                    mime_type != NULL &&
-                   !e_mail_part_get_is_attachment (part) &&
-                   g_ascii_strcasecmp (mime_type, "text/html") == 0 &&
-                   is_only_text_part_in_this_level (head, part)) {
-                       part->is_hidden = FALSE;
-                       hidden_text_html_part = part;
+                   !e_mail_part_get_is_attachment (part)) {
+                       if (!part->is_hidden &&
+                           g_ascii_strcasecmp (mime_type, "text/plain") == 0) {
+                               found_text_part = TRUE;
+                       } else if (g_ascii_strcasecmp (mime_type, "text/html") == 0) {
+                               if (!part->is_hidden) {
+                                       found_text_part = TRUE;
+                               } else if (is_only_text_part_in_this_level (head, part)) {
+                                       part->is_hidden = FALSE;
+                                       hidden_text_html_part = part;
+                               }
+                       }
                }
 
                is_validity_found |= e_mail_part_get_validity_flags (part);


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