aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Guenther <carsten.guenther@scalix.com>2005-08-18 00:00:00 +0800
committerCarsten Guenther <carsteng@src.gnome.org>2005-08-18 00:00:00 +0800
commit9c8e0e983c7775634641281c901953d1b17c32c8 (patch)
treebf9a0e25ad35404fdfe04a50e7f9375af5ca4803
parente31beb29c0165e6f6ce0f8389e421841c9d46bc7 (diff)
downloadgsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.tar
gsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.tar.gz
gsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.tar.bz2
gsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.tar.lz
gsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.tar.xz
gsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.tar.zst
gsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.zip
Fixes http://bugzilla.gnome.org/show_bug.cgi?id=313555 Only save
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. svn path=/trunk/; revision=30149
-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);
}