From e953820d261cf20176cd62f08b4212a676e8edec Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Thu, 24 Jan 2008 03:09:39 +0000 Subject: ** Fix for bug #337046 2008-01-22 Srinivasa Ragavan ** Fix for bug #337046 * gui/dialogs/comp-editor.c: (get_attachment_list): Have a ticking filename for attachment, if the mime doesn't carry it. svn path=/trunk/; revision=34875 --- calendar/gui/dialogs/comp-editor.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 6ddfdb6719..28f2751295 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -643,7 +643,7 @@ get_attachment_list (CompEditor *editor) GSList *parts = NULL, *list = NULL, *p = NULL; const char *comp_uid = NULL; const char *local_store = e_cal_get_local_attachment_store (editor->priv->client); - + int ticker=0; e_cal_component_get_uid (editor->priv->comp, &comp_uid); parts = e_attachment_bar_get_parts((EAttachmentBar *)editor->priv->attachment_bar); @@ -661,9 +661,16 @@ get_attachment_list (CompEditor *editor) * as a mime part file into the directory denoting the * calendar source */ utf8_safe_fname = camel_file_util_safe_filename (camel_mime_part_get_filename ((CamelMimePart *) p->data)); - safe_fname = g_filename_from_utf8 ((const char *) utf8_safe_fname, -1, NULL, NULL, NULL); - g_free (utf8_safe_fname); + /* It is absolutely fine to get a NULL from the filename of + * mime part. We assume that it is named "Attachment" + * in mailer. I'll do that with a ticker */ + if (!utf8_safe_fname) + safe_fname = g_strdup_printf ("%s-%d", _("attachment"), ticker++); + else { + safe_fname = g_filename_from_utf8 ((const char *) utf8_safe_fname, -1, NULL, NULL, NULL); + g_free (utf8_safe_fname); + } filename = g_strdup_printf ("%s-%s", comp_uid, safe_fname); attach_file_url = g_build_path ("/", local_store, filename, NULL); -- cgit v1.2.3