Display a warning and do not try to open empty attachments (#7332)

pull/7370/head
Aleksander Machniak 5 years ago
parent a2ee9f7eab
commit 377239fa8e

@ -14,6 +14,7 @@ CHANGELOG Roundcube Webmail
- Add support for SameSite cookie attribute via session_samesite option (req PHP >= 7.3.0) (#6772) - Add support for SameSite cookie attribute via session_samesite option (req PHP >= 7.3.0) (#6772)
- Elastic: Display a special icon for other users and shared namespace roots (#5012) - Elastic: Display a special icon for other users and shared namespace roots (#5012)
- Change folders sorting so shared/other users namespaces are listed last (#5012) - Change folders sorting so shared/other users namespaces are listed last (#5012)
- Display a warning and do not try to open empty attachments (#7332)
- Templates: Add support for expressions in object attributes (#7237) - Templates: Add support for expressions in object attributes (#7237)
- Templates: Add support for nested if conditions (#6818) - Templates: Add support for nested if conditions (#6818)
- Templates: Make [space][slash] ending of condition objects optional (#6954) - Templates: Make [space][slash] ending of condition objects optional (#6954)

@ -223,3 +223,4 @@ $messages['responseinserted'] = 'Response inserted successfully.';
$messages['listempty'] = 'The list is empty.'; $messages['listempty'] = 'The list is empty.';
$messages['listusebutton'] = 'Use the Create button to add a new record.'; $messages['listusebutton'] = 'Use the Create button to add a new record.';
$messages['keypaircreatesuccess'] = 'A new key pair has been successfully created for $identity.'; $messages['keypaircreatesuccess'] = 'A new key pair has been successfully created for $identity.';
$messages['emptyattachment'] = 'This attachment appears to be empty.<br>Please, check with the person who sent this.';

@ -209,20 +209,30 @@ function rcmail_message_attachments($attrib)
$item = html::span('attachment-name', rcube::Q($filename)) $item = html::span('attachment-name', rcube::Q($filename))
. html::span('attachment-size', '(' . rcube::Q($filesize) . ')'); . html::span('attachment-size', '(' . rcube::Q($filesize) . ')');
$li_class = $class;
if (!$PRINT_MODE) { if (!$PRINT_MODE) {
$item = html::a(array( $link_attrs = array(
'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false),
'onclick' => sprintf('return %s.command(\'load-attachment\',\'%s\',this)', 'onclick' => sprintf('return %s.command(\'load-attachment\',\'%s\',this)',
rcmail_output::JS_OBJECT_NAME, $attach_prop->mime_id), rcmail_output::JS_OBJECT_NAME, $attach_prop->mime_id),
'onmouseover' => $title ? '' : 'rcube_webmail.long_subject_title_ex(this, 0)', 'onmouseover' => $title ? '' : 'rcube_webmail.long_subject_title_ex(this, 0)',
'title' => $title, 'title' => $title,
'class' => 'filename', 'class' => 'filename',
), $item); );
if ($filesize == 0) {
$li_class .= ' no-menu';
$link_attrs['onclick'] = sprintf('%s.alert_dialog(%s.get_label(\'emptyattachment\')); return false',
rcmail_output::JS_OBJECT_NAME, rcmail_output::JS_OBJECT_NAME);
$RCMAIL->output->add_label('emptyattachment');
}
$item = html::a($link_attrs, $item);
$attachments[$attach_prop->mime_id] = $mimetype; $attachments[$attach_prop->mime_id] = $mimetype;
} }
$ol .= html::tag('li', array('class' => $class, 'id' => $id), $item); $ol .= html::tag('li', array('class' => $li_class, 'id' => $id), $item);
} }
$out = html::tag('ul', $attrib, $ol, html::$common_attrib); $out = html::tag('ul', $attrib, $ol, html::$common_attrib);

@ -1013,6 +1013,9 @@ function percent_indicator(obj, data)
function attachment_menu_append(item) function attachment_menu_append(item)
{ {
if ($(item).is('.no-menu'))
return;
$(item).append( $(item).append(
$('<a class="drop"></a>').on('click keypress', function(e) { $('<a class="drop"></a>').on('click keypress', function(e) {
if (e.type != 'keypress' || e.which == 13) { if (e.type != 'keypress' || e.which == 13) {

@ -905,7 +905,7 @@ function rcube_mail_ui()
{ {
item = $(item); item = $(item);
if (!item.children('.drop').length) { if (!item.children('.drop').length && !item.is('.no-menu')) {
var label = rcmail.gettext('options'), var label = rcmail.gettext('options'),
fname = item.find('a.filename'), fname = item.find('a.filename'),
tabindex = fname.attr('tabindex') || 0; tabindex = fname.attr('tabindex') || 0;

Loading…
Cancel
Save