aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-05-09 10:01:19 +0800
committerRodrigo Moya <rodrigo@gnome-db.org>2011-06-30 00:42:11 +0800
commit41b68582b610a0fbdaec02c9cc056dbf322fd91c (patch)
tree4f7550881b77ff7724e9b0d7ab007075043a4ca1 /mail
parent5fe38387996e3f37606a7bf1dbaec33d0ebfd6e4 (diff)
downloadgsoc2013-evolution-41b68582b610a0fbdaec02c9cc056dbf322fd91c.tar
gsoc2013-evolution-41b68582b610a0fbdaec02c9cc056dbf322fd91c.tar.gz
gsoc2013-evolution-41b68582b610a0fbdaec02c9cc056dbf322fd91c.tar.bz2
gsoc2013-evolution-41b68582b610a0fbdaec02c9cc056dbf322fd91c.tar.lz
gsoc2013-evolution-41b68582b610a0fbdaec02c9cc056dbf322fd91c.tar.xz
gsoc2013-evolution-41b68582b610a0fbdaec02c9cc056dbf322fd91c.tar.zst
gsoc2013-evolution-41b68582b610a0fbdaec02c9cc056dbf322fd91c.zip
Encode the path part of folder URIs.
Wasn't sure if this was necessary, but it -is- in order to handle the local Junk and Trash vfolder names correctly: .#evolution/Junk .#evolution/Trash If we don't escape the path and we feed camel_url_new() something like "folder://local/.#evolution/Trash", it's gonna think the path is '.' and the rest of it's a fragment.
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-folder-utils.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/mail/e-mail-folder-utils.c b/mail/e-mail-folder-utils.c
index fbd2dd3055..d73f13ad5c 100644
--- a/mail/e-mail-folder-utils.c
+++ b/mail/e-mail-folder-utils.c
@@ -176,6 +176,7 @@ e_mail_folder_uri_build (CamelStore *store,
const gchar *folder_name)
{
const gchar *uid;
+ gchar *encoded_name;
gchar *encoded_uid;
gchar *uri;
@@ -187,11 +188,14 @@ e_mail_folder_uri_build (CamelStore *store,
folder_name++;
uid = camel_service_get_uid (CAMEL_SERVICE (store));
+
encoded_uid = camel_url_encode (uid, ":;@/");
+ encoded_name = camel_url_encode (folder_name, "#");
- uri = g_strdup_printf ("folder://%s/%s", encoded_uid, folder_name);
+ uri = g_strdup_printf ("folder://%s/%s", encoded_uid, encoded_name);
g_free (encoded_uid);
+ g_free (encoded_name);
return uri;
}
@@ -230,7 +234,7 @@ e_mail_folder_uri_parse (CamelSession *session,
{
CamelURL *url;
CamelService *service = NULL;
- const gchar *folder_name = NULL;
+ gchar *folder_name = NULL;
gboolean success = FALSE;
g_return_val_if_fail (CAMEL_IS_SESSION (session), FALSE);
@@ -251,7 +255,7 @@ e_mail_folder_uri_parse (CamelSession *session,
}
if (url->path != NULL && *url->path == '/')
- folder_name = url->path + 1;
+ folder_name = camel_url_decode_path (url->path + 1);
/* This style was used to reference accounts by UID before
* CamelServices themselves had UIDs. Some examples are:
@@ -295,7 +299,7 @@ e_mail_folder_uri_parse (CamelSession *session,
}
if (url->path != NULL && *url->path == '/')
- folder_name = url->path + 1;
+ folder_name = g_strdup (url->path + 1);
/* CamelFolderInfo URIs used to embed the store's URI, so the
* folder name is appended as either a path part or a fragment
@@ -312,9 +316,9 @@ e_mail_folder_uri_parse (CamelSession *session,
provider = camel_service_get_provider (service);
if (provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH)
- folder_name = url->fragment;
+ folder_name = g_strdup (url->fragment);
else if (url->path != NULL && *url->path == '/')
- folder_name = url->path + 1;
+ folder_name = g_strdup (url->path + 1);
}
}
@@ -322,8 +326,10 @@ e_mail_folder_uri_parse (CamelSession *session,
if (out_store != NULL)
*out_store = g_object_ref (service);
- if (out_folder_name != NULL)
- *out_folder_name = g_strdup (folder_name);
+ if (out_folder_name != NULL) {
+ *out_folder_name = folder_name;
+ folder_name = NULL;
+ }
success = TRUE;
} else {
@@ -334,6 +340,8 @@ e_mail_folder_uri_parse (CamelSession *session,
folder_uri);
}
+ g_free (folder_name);
+
camel_url_free (url);
return success;