[evolution-data-server] Bug #607812 - Properly encode CalDAV URL



commit ed729af002b935f7ab8542f4177919859dfc22c2
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 3 20:42:48 2010 +0100

    Bug #607812 - Properly encode CalDAV URL
    
    In case the url is already encoded, then decode it first.

 calendar/backends/caldav/e-cal-backend-caldav.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index e8792b9..41c898d 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -2177,8 +2177,20 @@ initialize_backend (ECalBackendCalDAV *cbdav)
 
 		/* properly encode uri */
 		if (suri && suri->path) {
-			gchar *tmp = soup_uri_encode (suri->path, NULL);
-			gchar *path = soup_uri_normalize (tmp, "/");
+			gchar *tmp, *path;
+
+			if (suri->path && strchr (suri->path, '%')) {
+				/* If path contains anything already encoded, then decode it first,
+				   thus it'll be managed properly. For example, the '#' in a path
+				   is in URI shown as %23 and not doing this decode makes it being
+				   like %2523, which is not what is wanted here. */
+				tmp = soup_uri_decode (suri->path);
+				soup_uri_set_path (suri, tmp);
+				g_free (tmp);
+			}
+
+			tmp = soup_uri_encode (suri->path, NULL);
+			path = soup_uri_normalize (tmp, "/");
 
 			soup_uri_set_path (suri, path);
 



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