aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-01-21 20:22:30 +0800
committerMilan Crha <mcrha@redhat.com>2013-01-21 20:23:35 +0800
commit43911af529c0f357f71b4bb74b8a8c30db9ed384 (patch)
treea0ddd7fd65b20561739d7421d87c20d322eb1a4f /mail
parent4006edc2d236493a95c49eab13a3ae6d9aacc3d9 (diff)
downloadgsoc2013-evolution-43911af529c0f357f71b4bb74b8a8c30db9ed384.tar.gz
gsoc2013-evolution-43911af529c0f357f71b4bb74b8a8c30db9ed384.tar.zst
gsoc2013-evolution-43911af529c0f357f71b4bb74b8a8c30db9ed384.zip
Bug #692009 - text/css always formatted as attachment
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-request.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c
index c3f0b8552d..1deff94414 100644
--- a/mail/e-mail-request.c
+++ b/mail/e-mail-request.c
@@ -136,9 +136,34 @@ handle_mail_request (GSimpleAsyncResult *res,
}
if (part != NULL) {
- 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);
+ }
+
e_mail_part_unref (part);
} else {
g_warning ("Failed to lookup requested part '%s' - this should not happen!", part_id);