From e4c0c101ee54034e1b3a9b1f11eb50d88acb9e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Tue, 3 Apr 2012 17:56:58 +0200 Subject: Bug #673430 - Can't read messages in virtual Junk/Trash folders --- em-format/em-format.c | 12 +++++++++--- mail/e-mail-request.c | 4 +--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/em-format/em-format.c b/em-format/em-format.c index 071403d785..86fafdd539 100644 --- a/em-format/em-format.c +++ b/em-format/em-format.c @@ -2481,7 +2481,8 @@ em_format_build_mail_uri (CamelFolder *folder, folder_name = "generic"; service_uid = "generic"; } else { - folder_name = camel_folder_get_full_name (folder); + tmp = (gchar *) camel_folder_get_full_name (folder); + folder_name = (const gchar *) soup_uri_encode (tmp, NULL); store = camel_folder_get_parent_store (folder); if (store) service_uid = camel_service_get_uid (CAMEL_SERVICE (store)); @@ -2494,6 +2495,10 @@ em_format_build_mail_uri (CamelFolder *folder, folder_name, message_uid); + if (folder) { + g_free ((gchar *) folder_name); + } + va_start (ap, first_param_name); name = first_param_name; separator = '?'; @@ -2539,14 +2544,15 @@ em_format_build_mail_uri (CamelFolder *folder, va_end (ap); uri = tmp; + if (uri == NULL) + return NULL; /* For some reason, webkit won't accept URL with username, but * without password (mail://store@host/folder/mail), so we * will replace the '@' symbol by '/' to get URL like * mail://store/host/folder/mail which is OK */ - tmp = strchr (tmp, '@'); - if (tmp) { + while ((tmp = strchr (uri, '@')) != NULL) { tmp[0] = '/'; } diff --git a/mail/e-mail-request.c b/mail/e-mail-request.c index a99240e15c..9124b950c6 100644 --- a/mail/e-mail-request.c +++ b/mail/e-mail-request.c @@ -643,9 +643,7 @@ mail_request_send_async (SoupRequest *request, uri_str = g_strdup_printf ( "%s://%s%s", uri->scheme, uri->host, uri->path); - decoded_uri = soup_uri_decode (uri_str); - emr->priv->efh = g_hash_table_lookup (formatters, decoded_uri); - g_free (decoded_uri); + emr->priv->efh = g_hash_table_lookup (formatters, uri_str); g_free (uri_str); g_return_if_fail (emr->priv->efh); -- cgit v1.2.3