diff options
author | Milan Crha <mcrha@redhat.com> | 2013-01-21 20:25:38 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2013-01-21 20:25:38 +0800 |
commit | bfdec1f0aefc798f55803c7560b182ca983e27bf (patch) | |
tree | d990fb6b7380cc7c9cb0ac81a32634071fdfd676 /mail | |
parent | 45aeb9e236f411b77c193ea9631f721d658a771c (diff) | |
download | gsoc2013-evolution-bfdec1f0aefc798f55803c7560b182ca983e27bf.tar.gz gsoc2013-evolution-bfdec1f0aefc798f55803c7560b182ca983e27bf.tar.zst gsoc2013-evolution-bfdec1f0aefc798f55803c7560b182ca983e27bf.zip |
Bug #692009 - text/css always formatted as attachment
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-request.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c index f6c5164cbf..2b200c3b40 100644 --- a/mail/e-mail-request.c +++ b/mail/e-mail-request.c @@ -142,9 +142,33 @@ handle_mail_request (GSimpleAsyncResult *res, } if (part) { - e_mail_formatter_format_as ( - formatter, &context, part, request->priv->output_stream, - mime_type ? mime_type : part->mime_type, cancellable); + CamelContentType *content_type; + + content_type = camel_mime_part_get_content_type (part->part); + + if (context.mode == E_MAIL_FORMATTER_MODE_RAW && content_type && + camel_content_type_is (content_type, "text", "*") && + !camel_content_type_is (content_type, "text", "plain") && + !camel_content_type_is (content_type, "text", "html")) { + CamelDataWrapper *dw; + CamelStream *raw_content; + GByteArray *ba; + + dw = camel_medium_get_content (CAMEL_MEDIUM (part->part)); + g_return_if_fail (dw); + + raw_content = camel_stream_mem_new (); + camel_data_wrapper_decode_to_stream_sync (dw, raw_content, cancellable, NULL); + ba = camel_stream_mem_get_byte_array (CAMEL_STREAM_MEM (raw_content)); + + camel_stream_write (request->priv->output_stream, (gchar *) ba->data, ba->len, cancellable, NULL); + + g_object_unref (raw_content); + } else { + e_mail_formatter_format_as ( + formatter, &context, part, request->priv->output_stream, + mime_type ? mime_type : part->mime_type, cancellable); + } } else { g_warning ("Failed to lookup requested part '%s' - this should not happen!", part_id); } |