From 0a3955c5de625a95eec9d1320d8cc8a24dade021 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 13 Mar 2008 12:58:32 +0000 Subject: ** Fix for bug #460204 2008-03-13 Milan Crha ** Fix for bug #460204 * e-attachment.c: (attachment_guess_mime_type): Check whether found mime type is valid before returning it. My thanks come to Effenberg whom helped me to debug it. svn path=/trunk/; revision=35184 --- widgets/misc/ChangeLog | 8 ++++++++ widgets/misc/e-attachment.c | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 8714f3ff64..6186c3dbf6 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,11 @@ +2008-03-13 Milan Crha + + ** Fix for bug #460204 + + * e-attachment.c: (attachment_guess_mime_type): + Check whether found mime type is valid before returning it. + My thanks come to Effenberg whom helped me to debug it. + 2008-03-13 Milan Crha ** Fix for bug #512543 diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index 4bbaebd3ab..1383335499 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -275,6 +275,17 @@ attachment_guess_mime_type (const char *file_name) gnome_vfs_file_info_unref (info); + if (type) { + /* gnome_vfs can sometimes return invalid type, so check for it */ + CamelContentType *ctype = camel_content_type_decode (type); + + if (!ctype) { + g_free (type); + type = NULL; + } else + camel_content_type_unref (ctype); + } + return type; } -- cgit v1.2.3