Fix attachment sizes in message print page and attachment preview page (#1488515)
- Use size parameter from Content-Disposition header if specified,
- Calculate size of base64 encoded message parts
| | |
| | | CHANGELOG Roundcube Webmail |
| | | =========================== |
| | | |
| | | - Fix attachment sizes in message print page and attachment preview page (#1488515) |
| | | - Fix XSS vulnerability in message subject handling using Larry skin (#1488519) |
| | | - Fix handling of links with various URI schemes e.g. "skype:" (#1488106) |
| | | - Fix handling of links inside PRE elements on html to text conversion |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns real size (calculated) of the message part |
| | | * |
| | | * @param rcube_message_part Message part |
| | | * |
| | | * @return string Part size (and unit) |
| | | */ |
| | | public function message_part_size($part) |
| | | { |
| | | if (isset($part->d_parameters['size'])) { |
| | | $size = $this->show_bytes((int)$part->d_parameters['size']); |
| | | } |
| | | else { |
| | | $size = $part->size; |
| | | if ($part->encoding == 'base64') { |
| | | $size = $size / 1.33; |
| | | } |
| | | |
| | | $size = '~' . $this->show_bytes($size); |
| | | } |
| | | |
| | | return $size; |
| | | } |
| | | |
| | | |
| | | /************************************************************************ |
| | | ********* Deprecated methods (to be removed) ********* |
| | | ***********************************************************************/ |
| | |
| | | |
| | | function rcmail_message_part_controls($attrib) |
| | | { |
| | | global $MESSAGE; |
| | | global $MESSAGE, $RCMAIL; |
| | | |
| | | $part = asciiwords(get_input_value('_part', RCUBE_INPUT_GPC)); |
| | | if (!is_object($MESSAGE) || !is_array($MESSAGE->parts) || !($_GET['_uid'] && $_GET['_part']) || !$MESSAGE->mime_parts[$part]) |
| | |
| | | $table->add('download-link', html::a(array('href' => './?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING'])), Q(rcube_label('download')))); |
| | | } |
| | | |
| | | if (!empty($part->size)) { |
| | | $table->add('title', Q(rcube_label('filesize'))); |
| | | $table->add('header', Q(show_bytes($part->size))); |
| | | } |
| | | $table->add('header', Q($RCMAIL->message_part_size($part))); |
| | | |
| | | return $table->show($attrib); |
| | | } |
| | |
| | | |
| | | function rcmail_message_attachments($attrib) |
| | | { |
| | | global $PRINT_MODE, $MESSAGE; |
| | | global $PRINT_MODE, $MESSAGE, $RCMAIL; |
| | | |
| | | $out = $ol = ''; |
| | | |
| | |
| | | } |
| | | |
| | | if ($PRINT_MODE) { |
| | | $ol .= html::tag('li', null, sprintf("%s (%s)", Q($filename), Q(show_bytes($attach_prop->size)))); |
| | | $size = $RCMAIL->message_part_size($attach_prop); |
| | | $ol .= html::tag('li', null, Q(sprintf("%s (%s)", $filename, $size))); |
| | | } |
| | | else { |
| | | if (mb_strlen($filename) > 50) { |