From f4885180e033784758b7586c36dcfd46b0cad367 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 7 Feb 2008 17:50:53 +0000 Subject: ** Fix for bug #249501 2008-02-07 Milan Crha ** Fix for bug #249501 * e-attachment.c: (attachment_guess_mime_type): gnome_vfs_get_file_info expects URI, thus if file_name contains '%' it failed. svn path=/trunk/; revision=34971 --- widgets/misc/ChangeLog | 8 ++++++++ widgets/misc/e-attachment.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+) (limited to 'widgets') diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index 3e530c7cd2..4ff9f1d11c 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,11 @@ +2008-02-07 Milan Crha + + ** Fix for bug #249501 + + * e-attachment.c: (attachment_guess_mime_type): + gnome_vfs_get_file_info expects URI, + thus if file_name contains '%' it failed. + 2007-01-25 Johnny Jacob * e-filter-bar.h : Added a cameloperation cancel field for vfolder diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c index 911672098d..4bbaebd3ab 100644 --- a/widgets/misc/e-attachment.c +++ b/widgets/misc/e-attachment.c @@ -235,6 +235,21 @@ attachment_guess_mime_type (const char *file_name) GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE | GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + + if (result != GNOME_VFS_OK) { + CamelURL *url; + char *uri; + + url = camel_url_new ("file://", NULL); + camel_url_set_path (url, file_name); + uri = camel_url_to_string (url, 0); + camel_url_free (url); + + result = gnome_vfs_get_file_info (uri, info, GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE | GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + + g_free (uri); + } + if (result == GNOME_VFS_OK) { gchar *content = NULL; -- cgit v1.2.3