From fa462b5ab494f159f4a24b3d50d9fb63af5e9efe Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 10 Sep 2016 09:58:23 +0200 Subject: [PATCH] Fix displaying size of attachments with zero size --- CHANGELOG | 1 + program/include/rcmail.php | 11 ++++++++++- program/steps/mail/show.inc | 5 +---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7eb1f2887..8b1fcca60 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -18,6 +18,7 @@ CHANGELOG Roundcube Webmail - Fix PHP warning when handling shared namespace with empty prefix (#5420) - Fix so folders list is scrolled to the selected folder on page load (#5424) - Fix so when moving to Trash we make sure the folder exists (#5192) +- Fix displaying size of attachments with zero size RELEASE 1.2.1 ------------- diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 7a9d1a97b..310af6799 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -2248,11 +2248,20 @@ class rcmail extends rcube } else { $size = $part->size; + + if ($size === 0) { + $part->exact_size = true; + } + if ($part->encoding == 'base64') { $size = $size / 1.33; } - $size = '~' . $this->show_bytes($size); + $size = $this->show_bytes($size); + } + + if (!$part->exact_size) { + $size = '~' . $size; } return $size; diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 4183535f6..b990b58d6 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -217,10 +217,7 @@ function rcmail_message_attachments($attrib) $title = ''; } - if ($attach_prop->size) { - $size = ' ' . html::span('attachment-size', '(' . rcube::Q($filesize) . ')'); - } - + $size = ' ' . html::span('attachment-size', '(' . rcube::Q($filesize) . ')'); $mimetype = rcmail_fix_mimetype($attach_prop->mimetype); $class = rcube_utils::file2class($mimetype, $filename); $id = 'attach' . $attach_prop->mime_id;