[evolution-groupwise] Bug #655252 - Need to escape the comp_uid part of a path



commit 393e576138b913a8583682cb6ce1755817d375a8
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 26 11:05:11 2011 +0200

    Bug #655252 - Need to escape the comp_uid part of a path

 src/calendar/e-cal-backend-groupwise.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-groupwise.c b/src/calendar/e-cal-backend-groupwise.c
index 473fb86..b24ccb8 100644
--- a/src/calendar/e-cal-backend-groupwise.c
+++ b/src/calendar/e-cal-backend-groupwise.c
@@ -2244,18 +2244,15 @@ fetch_attachments (ECalBackendGroupwise *cbgw,
 	GSList *attach_list = NULL, *new_attach_list = NULL;
 	GSList *l;
 	gchar *dest_url, *dest_file;
-	gint fd;
-	const gchar *cache_dir;
+	gint fd, fileindex;
 	const gchar *uid;
 
 	e_cal_component_get_attachment_list (comp, &attach_list);
 	e_cal_component_get_uid (comp, &uid);
-	/*FIXME  get the uri rather than computing the path */
-	cache_dir = e_cal_backend_get_cache_dir (E_CAL_BACKEND (cbgw));
 
-	for (l = attach_list; l; l = l->next) {
+	for (l = attach_list, fileindex = 0; l; l = l->next, fileindex++) {
 		gchar *sfname = (gchar *) l->data;
-		gchar *filename, *new_filename;
+		gchar *filename;
 		GMappedFile *mapped_file;
 		GError *error = NULL;
 
@@ -2265,10 +2262,8 @@ fetch_attachments (ECalBackendGroupwise *cbgw,
 			continue;
 		}
 		filename = g_path_get_basename (sfname);
-		new_filename = g_strconcat (uid, "-", filename, NULL);
+		dest_file = e_cal_backend_create_cache_filename (E_CAL_BACKEND (cbgw), uid, filename, fileindex);
 		g_free (filename);
-		dest_file = g_build_filename (cache_dir, new_filename, NULL);
-		g_free (new_filename);
 		fd = g_open (dest_file, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0600);
 		if (fd == -1) {
 			/* TODO handle error conditions */



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