summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarish Krishnaswamy <kharish@novell.com>2006-06-15 14:40:08 +0000
committerHarish Krishnaswamy <kharish@src.gnome.org>2006-06-15 14:40:08 +0000
commitc47bf863e8ea1f2d404f8e47d7fc4d4ab53cc722 (patch)
treede71f8130a983f38348fae42da0f627d5016e297
parent2a5bbeb10562ab8e4a2de2493bb128e55834636f (diff)
downloadevolution-data-server-c47bf863e8ea1f2d404f8e47d7fc4d4ab53cc722.tar.gz
Handle attachment URLs with special characters that are not permitted in
2006-06-15 Harish Krishnaswamy <kharish@novell.com> * libecal/e-cal-component.c: (get_attachment_list), (set_attachment_list): Handle attachment URLs with special characters that are not permitted in ICAL. Fixes #178706 in bugzilla.novell.com.
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/libecal/e-cal-component.c18
2 files changed, 22 insertions, 3 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 5e58bc697..958ba437a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-15 Harish Krishnaswamy <kharish@novell.com>
+
+ * libecal/e-cal-component.c: (get_attachment_list),
+ (set_attachment_list): Handle attachment URLs with
+ special characters that are not permitted in
+ ICAL. Fixes #178706 in bugzilla.novell.com.
+
2006-06-15 Wang Xin <jedy.wang@sun.com>
Fixes #344253
diff --git a/calendar/libecal/e-cal-component.c b/calendar/libecal/e-cal-component.c
index 19b71c40b..b003d6377 100644
--- a/calendar/libecal/e-cal-component.c
+++ b/calendar/libecal/e-cal-component.c
@@ -1506,6 +1506,8 @@ get_attachment_list (GSList *attachment_list, GSList **al)
for (l = attachment_list; l; l = l->next) {
struct attachment *attachment;
const char *data;
+ size_t buf_size;
+ char *buf;
attachment = l->data;
g_assert (attachment->attach != NULL);
@@ -1516,10 +1518,15 @@ get_attachment_list (GSList *attachment_list, GSList **al)
*/
icalattach_ref (attachment->attach);
data = icalattach_get_url (attachment->attach);
+ g_message ("Before decoding %s\n", data);
+ buf_size = strlen (data);
+ buf = g_malloc0 (buf_size);
+ icalvalue_decode_ical_string (data, buf, buf_size);
}
else
data = NULL;
- *al = g_slist_prepend (*al, (char *)data);
+ g_message ("After decoding: %s\n", buf);
+ *al = g_slist_prepend (*al, (char *)buf);
}
*al = g_slist_reverse (*al);
@@ -1555,12 +1562,17 @@ set_attachment_list (icalcomponent *icalcomp,
for (l = al; l; l = l->next) {
struct attachment *attachment;
+ size_t buf_size;
+ char *buf;
attachment = g_new0 (struct attachment, 1);
- attachment->attach = icalattach_new_from_url ((char *) l->data);
+ buf_size = 2 * strlen ((char *)l->data);
+ buf = g_malloc0 (buf_size);
+ icalvalue_encode_ical_string (l->data, buf, buf_size);
+ attachment->attach = icalattach_new_from_url ((char *) buf);
attachment->prop = icalproperty_new_attach (attachment->attach);
icalcomponent_add_property (icalcomp, attachment->prop);
-
+ g_free (buf);
*attachment_list = g_slist_prepend (*attachment_list, attachment);
}