diff options
author | Carsten Guenther <carsten.guenther@scalix.com> | 2005-08-18 00:00:00 +0800 |
---|---|---|
committer | Carsten Guenther <carsteng@src.gnome.org> | 2005-08-18 00:00:00 +0800 |
commit | 9c8e0e983c7775634641281c901953d1b17c32c8 (patch) | |
tree | bf9a0e25ad35404fdfe04a50e7f9375af5ca4803 /calendar/gui | |
parent | e31beb29c0165e6f6ce0f8389e421841c9d46bc7 (diff) | |
download | gsoc2013-evolution-9c8e0e983c7775634641281c901953d1b17c32c8.tar.gz 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
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 29 |
1 files changed, 16 insertions, 13 deletions
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); } |