[evolution-patches] fix for bug #44457



since the mail-format.c code didn't know how to handle video/* types, it
had gnome-vfs sniff it. gnome-vfs told us it was text/x-troff-man and so
we tried to display it as text. since the content->rawtext bit was not
set, we assumed it was already in UTF-8 and so didn't bother to convert
- crash.

the camel portion of the patch changes rawtext to just raw and makes it
default to TRUE so that application/octet-stream, etc parts have this
bit set always. the change from rawtext to raw could be undone, I mostly
just did it because the name "rawtext" isn't really appropriate for
non-textual parts.

the mailer patch fixes it so that we don't sniff a mime part unless it
was declared as application/octet-stream (any other mime type doesn't
make sense to sniff, since presumably the declared mime-type is
correct).

another way (smaller patch) to fix this bug would be to make it so that
handle_text_plain() checked the actualy mime-type of the part and if it
was not text/*, then set content->rawtext to TRUE, but that seemed like
an ugly hack so I opted for the slightly larger fix, but which seemed
like the more correct fix.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1827
diff -u -r1.1827 ChangeLog
--- ChangeLog	11 Jun 2003 20:36:05 -0000	1.1827
+++ ChangeLog	11 Jun 2003 20:44:11 -0000
@@ -1,3 +1,30 @@
+2003-06-11  Jeffrey Stedfast  <fejj ximian com>
+
+	Partial fix for bug #44457.
+
+	* camel-mime-part-utils.c
+	(simple_data_wrapper_construct_from_parser): Same as below, but
+	also set content->raw to FALSE if the conversion to UTF-8 goes
+	smoothly since content->raw now defaults to TRUE instead of FALSE.
+
+	* camel-mime-part.c (write_to_stream): s/rawtext/raw/
+
+	* camel-data-wrapper.c (camel_data_wrapper_init): Change rawtext
+	to raw and default to TRUE instead of FALSE.
+
+2003-06-05  Jeffrey Stedfast  <fejj ximian com>
+
+	Fix for bug #40788.
+
+	* providers/pop3/camel-pop3-engine.c (camel_pop3_engine_new): Now
+	takes a flags argument. Currently there is only 1 flag which can
+	be used to disable Pop3 server extensions.
+	(get_capabilities): Don't check for Pop3 server extensions if the
+	DISABLE_EXTENSIONS flag is set on the engine.
+
+	* providers/pop3/camel-pop3-store.c (connect_to_server): Check for
+	the disable_extensions param.
+
 2003-06-04  Jeffrey Stedfast  <fejj ximian com>
 
 	* camel-uid-cache.c (camel_uid_cache_new): Create the directory
Index: camel-data-wrapper.h
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-data-wrapper.h,v
retrieving revision 1.46
diff -u -r1.46 camel-data-wrapper.h
--- camel-data-wrapper.h	2 Nov 2001 23:53:36 -0000	1.46
+++ camel-data-wrapper.h	11 Jun 2003 20:44:11 -0000
@@ -49,7 +49,7 @@
 	CamelStream *stream;
 	
 	unsigned int offline:1;
-	unsigned int rawtext:1;
+	unsigned int raw:1;
 };
 
 typedef struct {
Index: camel-data-wrapper.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-data-wrapper.c,v
retrieving revision 1.53
diff -u -r1.53 camel-data-wrapper.c
--- camel-data-wrapper.c	2 Nov 2001 23:53:36 -0000	1.53
+++ camel-data-wrapper.c	11 Jun 2003 20:44:15 -0000
@@ -76,7 +76,7 @@
 	
 	camel_data_wrapper->mime_type = header_content_type_new ("application", "octet-stream");
 	camel_data_wrapper->offline = FALSE;
-	camel_data_wrapper->rawtext = FALSE;
+	camel_data_wrapper->raw = TRUE;
 }
 
 static void
Index: camel-mime-part.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-part.c,v
retrieving revision 1.149
diff -u -r1.149 camel-mime-part.c
--- camel-mime-part.c	16 May 2003 18:47:49 -0000	1.149
+++ camel-mime-part.c	11 Jun 2003 20:44:26 -0000
@@ -695,7 +695,7 @@
 			break;
 		}
 		
-		if (!content->rawtext && header_content_type_is(mp->content_type, "text", "*")) {
+		if (!content->raw && header_content_type_is(mp->content_type, "text", "*")) {
 			charset = header_content_type_param(mp->content_type, "charset");
 			if (charset && !(!strcasecmp(charset, "us-ascii") || !strcasecmp(charset, "utf-8"))) {
 				charenc = (CamelMimeFilter *)camel_mime_filter_charset_new_convert("UTF-8", charset);
Index: camel-mime-part-utils.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-part-utils.c,v
retrieving revision 1.89
diff -u -r1.89 camel-mime-part-utils.c
--- camel-mime-part-utils.c	16 May 2003 18:47:49 -0000	1.89
+++ camel-mime-part-utils.c	11 Jun 2003 20:44:28 -0000
@@ -380,23 +380,24 @@
 		if (out) {
 			/* converted ok, use this data instead */
 			g_byte_array_free(buffer, TRUE);
+			dw->raw = FALSE;
 			buffer = out;
 		} else {
 			/* else failed to convert, leave as raw? */
 			g_warning("Storing text as raw, unknown charset '%s' or invalid format", charset);
-			dw->rawtext = TRUE;
+			dw->raw = TRUE;
 		}
 	} else if (header_content_type_is (ct, "text", "*")) {
 		if (charset == NULL || !strcasecmp (charset, "us-ascii")) {
 			/* check that it's 7bit */
-			dw->rawtext = !is_7bit (buffer);
+			dw->raw = !is_7bit (buffer);
 		} else if (!strncasecmp (charset, "x-", 2)) {
 			/* we're not even going to bother trying to convert, so set the
-			   rawtext bit to TRUE and let the mailer deal with it. */
-			dw->rawtext = TRUE;
+			   raw bit to TRUE and let the mailer deal with it. */
+			dw->raw = TRUE;
 		} else if (!strcasecmp (charset, "utf-8") && buffer->len) {
 			/* check that it is valid utf8 */
-			dw->rawtext = !g_utf8_validate (buffer->data, buffer->len, NULL);
+			dw->raw = !g_utf8_validate (buffer->data, buffer->len, NULL);
 		}
 	}
 	
? 43862.patch
? 43972-mailer.patch
? 44457-mailer.patch
? crash.txt
? empty-subject.patch
? global-gconf.patch
? mail-local.patch
? message-tree.c
? message-tree.h
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2747
diff -u -r1.2747 ChangeLog
--- ChangeLog	11 Jun 2003 16:19:33 -0000	1.2747
+++ ChangeLog	11 Jun 2003 21:46:00 -0000
@@ -1,3 +1,12 @@
+2003-06-11  Jeffrey Stedfast  <fejj ximian com>
+
+	* mail-format.c (format_mime_part): We only really want to use
+	mail_identify_mime_part() if the content-type is
+	application/octet-stream - any other type (if it doesn't have a
+	handler) should just force the user to save to disk.
+	(handle_text_plain): Only pay attention to format=flowed if the
+	mime-type is text/plain.
+
 2003-06-06  Jeffrey Stedfast  <fejj ximian com>
 
 	* message-tag-followup.c (get_week_start_day): Use mail-config's
Index: mail-format.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-format.c,v
retrieving revision 1.285
diff -u -r1.285 mail-format.c
--- mail-format.c	11 Jun 2003 16:19:35 -0000	1.285
+++ mail-format.c	11 Jun 2003 21:46:00 -0000
@@ -494,7 +494,7 @@
 		goto reg;
 	}
 	
-	/* If we at least got an application, use that. */
+	/* If we at least got an application list, use that. */
 	if (handler->applications) {
 		handler->generic = TRUE;
 		handler->is_bonobo = FALSE;
@@ -724,7 +724,8 @@
 		
 		if (!strcmp (mime_type, "application/mac-binhex40")) {
 			handler = NULL;
-		} else {
+		} else if (!strcmp (mime_type, "application/octet-stream")) {
+			/* only sniff application/octet-stream parts */
 			id_type = mail_identify_mime_part (part, md);
 			if (id_type) {
 				g_free (mime_type);
@@ -1124,7 +1125,7 @@
 	
 	filtered_stream = camel_stream_filter_new_with_stream (stream);
 	
-	if (wrapper->rawtext || (mail_display && mail_display->charset)) {
+	if (wrapper->raw || (mail_display && mail_display->charset)) {
 		CamelMimeFilterCharset *filter;
 		CamelContentType *content_type;
 		GConfClient *gconf;
@@ -1134,7 +1135,7 @@
 		
 		content_type = camel_data_wrapper_get_mime_type_field (wrapper);
 		
-		if (!wrapper->rawtext) {
+		if (!wrapper->raw) {
 			/* data wrapper had been successfully converted to UTF-8 using the mime
 			   part's charset, but the user thinks he knows best so we'll let him
 			   shoot himself in the foot here... */
@@ -1254,9 +1255,12 @@
 	
 	/* Check for RFC 2646 flowed text. */
 	type = camel_mime_part_get_content_type (part);
-	format = header_content_type_param (type, "format");
-	if (format && !strcasecmp (format, "flowed"))
-		flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED;
+	if (header_content_type_is (type, "text", "plain")) {
+		format = header_content_type_param (type, "format");
+		
+		if (format && !strcasecmp (format, "flowed"))
+			flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED;
+	}
 	
 	html_filter = camel_mime_filter_tohtml_new (flags, rgb);
 	filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *) stream);


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