[evolution] Assure that the filename <-> uri conversion are done with g_filename_{to, from}_uri and not by concat



commit f4ecf2d62fd8766fa0b0c7d6483d9a583459267c
Author: Fridrich Strba <FStrba novell com>
Date:   Mon May 4 10:48:31 2009 +0530

    Assure that the filename <-> uri conversion are done with g_filename_{to,from}_uri and not by concatenating strings which is broken with win32-style uris
---
 calendar/gui/migration.c      |    2 +-
 mail/em-format-html-display.c |    2 +-
 mail/mail-ops.c               |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c
index 0f012d5..8a68e4f 100644
--- a/calendar/gui/migration.c
+++ b/calendar/gui/migration.c
@@ -317,7 +317,7 @@ migrate_ical_folder_to_source (char *old_path, ESource *new_source, ECalSourceTy
 	ECal *old_ecal = NULL, *new_ecal = NULL;
 	ESource *old_source;
 	ESourceGroup *group;
-	char *old_uri = g_strdup_printf ("file://%s", old_path);
+	char *old_uri = g_filename_to_uri (old_path, NULL, NULL);
 	GError *error = NULL;
 	gboolean retval = FALSE;
 
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 1fa5809..f20af59 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -788,7 +788,7 @@ efhd_get_uri_puri (GtkWidget *html, GdkEventButton *event, EMFormatHTMLDisplay *
 
 	if (img_url) {
 		if (!(strstr (img_url, "://") || g_ascii_strncasecmp (img_url, "cid:", 4) == 0)) {
-			char *u = g_strconcat ("file://", img_url, NULL);
+			char *u = g_filename_to_uri (img_url, NULL, NULL);
 			g_free (img_url);
 			img_url = u;
 		}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 0eb6c94..a8aa14d 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -2062,7 +2062,7 @@ save_messages_exec (struct _save_messages_msg *m)
 	if (strstr (m->path, "://"))
 		path = m->path;
 	else
-		path = g_strjoin (NULL, "file://", m->path, NULL);
+		path = g_filename_to_uri (m->path, NULL, NULL);
 
 	stream = camel_stream_vfs_new_with_uri (path, CAMEL_STREAM_VFS_CREATE);
 	from_filter = camel_mime_filter_from_new();
@@ -2176,7 +2176,7 @@ save_part_exec (struct _save_part_msg *m)
 	if (strstr (m->path, "://"))
 		path = m->path;
 	else
-		path = g_strjoin (NULL, "file://", m->path, NULL);
+		path = g_filename_to_uri (m->path, NULL, NULL);
 
 	if(!m->readonly){
 		if (!(stream = camel_stream_vfs_new_with_uri (path, CAMEL_STREAM_VFS_CREATE))) {



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