--- evolution-2.9.3/mail/mail-ops.c.view-attachment-uri 2006-12-06 10:26:24.000000000 -0500 +++ evolution-2.9.3/mail/mail-ops.c 2006-12-06 11:16:46.000000000 -0500 @@ -2089,21 +2089,23 @@ save_part_save (struct _mail_msg *mm) { struct _save_part_msg *m = (struct _save_part_msg *)mm; + mode_t mode = S_IRUSR | S_IRGRP | S_IROTH; + int flags = O_WRONLY | O_CREAT | O_TRUNC; CamelDataWrapper *content; CamelStream *stream; - - if(!m->readonly){ - if (!(stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0644))) { - camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, - _("Cannot create output file: %s:\n %s"), - m->path, g_strerror (errno)); - return; - } - } else if (!(stream = camel_stream_vfs_new_with_uri (m->path, O_WRONLY | O_CREAT | O_TRUNC, 0444))) { + gchar *uri; + + uri = g_filename_to_uri (m->path, NULL, NULL); + + if (!m->readonly) + mode |= S_IWUSR; + + stream = camel_stream_vfs_new_with_uri (uri, flags, mode); + if (stream == NULL) { camel_exception_setv (&mm->ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot create output file: %s:\n %s"), m->path, g_strerror (errno)); - return; + goto exit; } content = camel_medium_get_content_object (CAMEL_MEDIUM (m->part)); @@ -2115,6 +2117,9 @@ g_strerror (errno)); camel_object_unref (stream); + +exit: + g_free (uri); } static void