[evolution] e-mail-parser: Guess inner data mime type after extract from S/MIME blob



commit 25b785a8064427dbd137591fd5b6eecb23c02a5e
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jan 23 14:10:13 2020 +0100

    e-mail-parser: Guess inner data mime type after extract from S/MIME blob
    
    Let the parser recheck the inner data mime type in S/MIME encrypted
    or signed blob, to properly present it in the GUI. The default type
    is text/plain, but the content can be anything, not only plain text.

 src/em-format/e-mail-parser-application-smime.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/em-format/e-mail-parser-application-smime.c b/src/em-format/e-mail-parser-application-smime.c
index 0052089b86..116df4ebe8 100644
--- a/src/em-format/e-mail-parser-application-smime.c
+++ b/src/em-format/e-mail-parser-application-smime.c
@@ -115,12 +115,24 @@ empe_app_smime_parse (EMailParserExtension *extension,
                g_error_free (local_error);
 
        } else {
+               CamelContentType *ct;
                GQueue work_queue = G_QUEUE_INIT;
                GList *head, *link;
                gint len = part_id->len;
 
                g_string_append (part_id, ".encrypted-smime");
 
+               ct = camel_data_wrapper_get_mime_type_field (CAMEL_DATA_WRAPPER (opart));
+
+               if (!ct || camel_content_type_is (ct, "text", "plain")) {
+                       const gchar *mime_type;
+
+                       mime_type = e_mail_part_snoop_type (opart);
+
+                       if (mime_type && g_ascii_strcasecmp (mime_type, "text/plain") != 0)
+                               camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (opart), mime_type);
+               }
+
                e_mail_parser_parse_part (
                        parser, opart, part_id, cancellable, &work_queue);
 


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