Fix display issues with mail subject that contains line-breaks (#7191)

pull/7203/head
Aleksander Machniak 5 years ago
parent 8080eb2c71
commit d340f18295

@ -29,6 +29,8 @@ CHANGELOG Roundcube Webmail
- Fix recipient duplicates in print-view when the recipient list has been expanded (#7169) - Fix recipient duplicates in print-view when the recipient list has been expanded (#7169)
- Fix bug where files in skins/ directory were listed on skins list (#7180) - Fix bug where files in skins/ directory were listed on skins list (#7180)
- Fix bug where message parts with no Content-Disposition header and no name were not listed on attachments list (#7117) - Fix bug where message parts with no Content-Disposition header and no name were not listed on attachments list (#7117)
- Fix display issues with mail subject that contains line-breaks (#7191)
- Fix invalid Content-Transfer-Encoding on multipart messages - Mail_Mime fix (#7170)
RELEASE 1.4.2 RELEASE 1.4.2
------------- -------------

@ -1129,6 +1129,19 @@ class rcube
return rcube_utils::rep_specialchars_output($str, 'js'); return rcube_utils::rep_specialchars_output($str, 'js');
} }
/**
* Quote a given string, remove new-line characters, use strict mode.
* Shortcut function for rcube_utils::rep_specialchars_output()
*
* @param string $str A string to quote
*
* @return string HTML-quoted string
*/
public static function SQ($str)
{
return rcube_utils::rep_specialchars_output($str, 'html', 'strict', false);
}
/** /**
* Construct shell command, execute it and return output as string. * Construct shell command, execute it and return output as string.
* Keywords {keyword} are replaced with arguments * Keywords {keyword} are replaced with arguments

@ -124,7 +124,7 @@ class rcube_message
} }
$this->mime = new rcube_mime($this->headers->charset); $this->mime = new rcube_mime($this->headers->charset);
$this->subject = $this->headers->get('subject'); $this->subject = str_replace("\n", '', $this->headers->get('subject'));
$from = $this->mime->decode_address_list($this->headers->from, 1); $from = $this->mime->decode_address_list($this->headers->from, 1);
$this->sender = current($from); $this->sender = current($from);

@ -510,7 +510,7 @@ function rcmail_js_message_list($a_headers, $insert_top=false, $a_show_cols=null
else if ($col == 'subject') { else if ($col == 'subject') {
$cont = trim(rcube_mime::decode_header($header->$col, $header->charset)); $cont = trim(rcube_mime::decode_header($header->$col, $header->charset));
if (!$cont) $cont = $RCMAIL->gettext('nosubject'); if (!$cont) $cont = $RCMAIL->gettext('nosubject');
$cont = rcube::Q($cont); $cont = rcube::SQ($cont);
} }
else if ($col == 'size') else if ($col == 'size')
$cont = $RCMAIL->show_bytes($header->$col); $cont = $RCMAIL->show_bytes($header->$col);
@ -523,10 +523,10 @@ function rcmail_js_message_list($a_headers, $insert_top=false, $a_show_cols=null
$last_folder_name = str_replace($delimiter, " \xC2\xBB ", $last_folder_name); $last_folder_name = str_replace($delimiter, " \xC2\xBB ", $last_folder_name);
} }
$cont = rcube::Q($last_folder_name); $cont = rcube::SQ($last_folder_name);
} }
else else
$cont = rcube::Q($header->$col); $cont = rcube::SQ($header->$col);
$a_msg_cols[$col] = $cont; $a_msg_cols[$col] = $cont;
} }
@ -1308,7 +1308,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
$mailto = rcube_utils::idn_to_utf8($mailto); $mailto = rcube_utils::idn_to_utf8($mailto);
if ($PRINT_MODE) { if ($PRINT_MODE) {
$address = sprintf('%s <%s>', rcube::Q($name), rcube::Q($mailto)); $address = sprintf('%s <%s>', rcube::SQ($name), rcube::Q($mailto));
} }
else if ($valid) { else if ($valid) {
if ($linked) { if ($linked) {
@ -1320,10 +1320,10 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
); );
if ($show_email && $name && $mailto) { if ($show_email && $name && $mailto) {
$content = rcube::Q($name ? sprintf('%s <%s>', $name, $mailto) : $mailto); $content = rcube::SQ($name ? sprintf('%s <%s>', $name, $mailto) : $mailto);
} }
else { else {
$content = rcube::Q($name ?: $mailto); $content = rcube::SQ($name ?: $mailto);
$attrs['title'] = $mailto; $attrs['title'] = $mailto;
} }
@ -1331,7 +1331,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
} }
else { else {
$address = html::span(array('title' => $mailto, 'class' => "rcmContactAddress"), $address = html::span(array('title' => $mailto, 'class' => "rcmContactAddress"),
rcube::Q($name ?: $mailto)); rcube::SQ($name ?: $mailto));
} }
if ($addicon && $_SESSION['writeable_abook']) { if ($addicon && $_SESSION['writeable_abook']) {

@ -494,16 +494,16 @@ function rcmail_message_headers($attrib, $headers=null)
// single header value is requested // single header value is requested
if (!empty($attrib['valueof'])) { if (!empty($attrib['valueof'])) {
$row = $plugin['output'][$attrib['valueof']]; $row = $plugin['output'][$attrib['valueof']];
return $row['html'] ? $row['value'] : rcube::Q($row['value']); return $row['html'] ? $row['value'] : rcube::SQ($row['value']);
} }
// compose html table // compose html table
$table = new html_table(array('cols' => 2)); $table = new html_table(array('cols' => 2));
foreach ($plugin['output'] as $hkey => $row) { foreach ($plugin['output'] as $hkey => $row) {
$val = $row['html'] ? $row['value'] : rcube::Q($row['value']); $val = $row['html'] ? $row['value'] : rcube::SQ($row['value']);
$table->add(array('class' => 'header-title'), rcube::Q($row['title'])); $table->add(array('class' => 'header-title'), rcube::SQ($row['title']));
$table->add(array('class' => 'header '.$hkey), $val); $table->add(array('class' => 'header '.$hkey), $val);
} }

Loading…
Cancel
Save