aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/dialogs/comp-editor.c29
2 files changed, 23 insertions, 13 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 46f746bd59..b33ee7be25 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-17 Carsten Guenther <carsten.guenther@scalix.com>
+
+ Fixes http://bugzilla.gnome.org/show_bug.cgi?id=313555
+ * gui/dialogs/comp-editor.c:
+ (get_attachment_list): Only save attachment to file
+ if file does not exist yet.
+
2005-08-17 Chenthill Palanisamy <pchenthill@novell.com>
Fixes #311904
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 93b654e3ba..c7178f17fe 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -630,24 +630,27 @@ get_attachment_list (CompEditor *editor)
g_free (filename);
g_free (safe_fname);
- stream = camel_stream_fs_new_with_name((const char *) attach_file_url+7, O_RDWR|O_CREAT|O_TRUNC, 0600);
- if (!stream) {
- /* TODO handle error conditions */
- g_message ("DEBUG: could not open the file to write\n");
- g_free (attach_file_url);
- continue;
- }
+ /* do not overwrite existing files, this will result in truncation */
+ if (!g_file_test (attach_file_url+7, G_FILE_TEST_EXISTS)) {
+ stream = camel_stream_fs_new_with_name((const char *) attach_file_url+7, O_RDWR|O_CREAT|O_TRUNC, 0600);
+ if (!stream) {
+ /* TODO handle error conditions */
+ g_message ("DEBUG: could not open the file to write\n");
+ g_free (attach_file_url);
+ continue;
+ }
- if (camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) stream) == -1) {
- g_free (attach_file_url);
+ if (camel_data_wrapper_decode_to_stream (wrapper, (CamelStream *) stream) == -1) {
+ g_free (attach_file_url);
+ camel_stream_close (stream);
+ camel_object_unref (stream);
+ g_message ("DEBUG: could not write to file\n");
+ }
+
camel_stream_close (stream);
camel_object_unref (stream);
- g_message ("DEBUG: could not write to file\n");
}
- camel_stream_close (stream);
- camel_object_unref (stream);
-
list = g_slist_append (list, g_strdup (attach_file_url));
g_free (attach_file_url);
}