[evolution/webkit: 119/182] Fix loading size of attachment (bug #667541)
- From: Dan VrÃtil <dvratil src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/webkit: 119/182] Fix loading size of attachment (bug #667541)
- Date: Tue, 6 Mar 2012 16:18:43 +0000 (UTC)
commit e22da0bacdb837296e6023a2bdebe8205f1a89d7
Author: Dan VrÃtil <dan progdan cz>
Date: Wed Jan 18 20:47:26 2012 +0100
Fix loading size of attachment (bug #667541)
I think I found a simple way how to get size of an attachment: just looking
on size of the respective MIME part (and multiplying it by 0.73 if it's base64 encoded).
This seems to be more simple and faster then the previous method, which didn't
work for the webkit port since camel_folder_summary_guess_content_info always
returned NULL
mail/em-format-html-display.c | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 05a75b0..e989019 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -552,22 +552,15 @@ efhd_parse_attachment (EMFormat *emf,
e_attachment_store_add_attachment (store, puri->attachment);
if (emf->folder && emf->folder->summary && emf->message_uid) {
- CamelMessageInfo *mi;
-
- mi = camel_folder_summary_get (emf->folder->summary, emf->message_uid);
- if (mi) {
- const CamelMessageContentInfo *ci;
-
- ci = camel_folder_summary_guess_content_info (mi,
- camel_mime_part_get_content_type (puri->puri.part));
- if (ci) {
- size = ci->size;
- /* what if its not encoded in base64 ? is it a case to consider? */
- if (ci->encoding && !g_ascii_strcasecmp (ci->encoding, "base64"))
- size = size / 1.37;
- }
- camel_message_info_free (mi);
- }
+ CamelDataWrapper *dw = camel_medium_get_content (CAMEL_MEDIUM (puri->puri.part));
+ GByteArray *ba;
+ ba = camel_data_wrapper_get_byte_array (dw);
+ if (ba) {
+ size = ba->len;
+
+ if (camel_mime_part_get_encoding (puri->puri.part) == CAMEL_TRANSFER_ENCODING_BASE64)
+ size = size / 1.37;
+ }
}
load_data = g_new0 (struct attachment_load_data, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]