aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-05-13 09:43:37 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-05-21 09:58:46 +0800
commit099293ed216aac18a42dd3c41906978f44b056b1 (patch)
tree9604bf814d431f467ba629d8ba5bc522f2016b90 /widgets/misc
parent246afc7a4a2d827376d33084a8f162bdbc55c0d8 (diff)
downloadgsoc2013-evolution-099293ed216aac18a42dd3c41906978f44b056b1.tar.gz
gsoc2013-evolution-099293ed216aac18a42dd3c41906978f44b056b1.tar.zst
gsoc2013-evolution-099293ed216aac18a42dd3c41906978f44b056b1.zip
Bug 440919 – Evolution can't attach "zero length" files
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-attachment.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/widgets/misc/e-attachment.c b/widgets/misc/e-attachment.c
index 537a3470d7..67647116e3 100644
--- a/widgets/misc/e-attachment.c
+++ b/widgets/misc/e-attachment.c
@@ -418,6 +418,10 @@ attachment_progress_cb (goffset current_num_bytes,
goffset total_num_bytes,
EAttachment *attachment)
{
+ /* Avoid dividing by zero. */
+ if (total_num_bytes == 0)
+ return;
+
attachment->priv->percent =
(current_num_bytes * 100) / total_num_bytes;
@@ -1493,6 +1497,12 @@ attachment_load_finish (LoadContext *load_context)
if (disposition != NULL)
camel_mime_part_set_disposition (mime_part, disposition);
+ /* Correctly report the size of zero length special files. */
+ if (g_file_info_get_size (file_info) == 0) {
+ g_file_info_set_size (file_info, size);
+ attachment_set_file_info (attachment, file_info);
+ }
+
g_simple_async_result_set_op_res_gpointer (
simple, mime_part, (GDestroyNotify) camel_object_unref);