Fix bug where bold/strong text was converted to upper-case on html-to-text conversion (6758)

pull/6841/head
Aleksander Machniak 6 years ago
parent de25226d31
commit 55ebae3c1e

@ -7,6 +7,7 @@ CHANGELOG Roundcube Webmail
- Enigma: Fix "decryption oracle" bug [CVE-2019-10740] (#6638)
- Fix bug where bmp images couldn't be displayed on some systems (#6728)
- Fix bug in parsing vCard data using PHP 7.3 due to an invalid regexp (#6744)
- Fix bug where bold/strong text was converted to upper-case on html-to-text conversion (6758)
RELEASE 1.3.9
-------------

@ -248,8 +248,6 @@ class rcube_html2text
protected $callback_search = array(
'/<(a) [^>]*href=("|\')([^"\']+)\2[^>]*>(.*?)<\/a>/i', // <a href="">
'/<(h)[123456]( [^>]*)?>(.*?)<\/h[123456]>/i', // h1 - h6
'/<(b)( [^>]*)?>(.*?)<\/b>/i', // <b>
'/<(strong)( [^>]*)?>(.*?)<\/strong>/i', // <strong>
'/<(th)( [^>]*)?>(.*?)<\/th>/i', // <th> and </th>
);
@ -659,9 +657,6 @@ class rcube_html2text
public function tags_preg_callback($matches)
{
switch (strtolower($matches[1])) {
case 'b':
case 'strong':
return $this->_toupper($matches[3]);
case 'th':
return $this->_toupper("\t\t". $matches[3] ."\n");
case 'h':

@ -27,19 +27,19 @@ class rc_html2text extends PHPUnit_Framework_TestCase
'out' => '&quot;',
),
3 => array(
'title' => 'HTML entity in STRONG tag',
'in' => '<strong>&#347;</strong>', // ś
'out' => 'Ś', // upper ś
'title' => 'HTML entity in H1 tag',
'in' => '<h1>&#347;</h1>', // ś
'out' => "Ś\n\n", // upper ś
),
4 => array(
'title' => 'STRONG tag to upper-case conversion',
'in' => '<strong>ś</strong>',
'out' => 'Ś',
'title' => 'H1 tag to upper-case conversion',
'in' => '<h1>ś</h1>',
'out' => "Ś\n\n",
),
5 => array(
'title' => 'STRONG inside B tag',
'in' => '<b><strong>&#347;</strong></b>',
'out' => 'Ś',
'title' => 'H1 inside B tag',
'in' => '<b><h1>&#347;</h1></b>',
'out' => "Ś\n\n",
),
6 => array(
'title' => 'Don\'t remove non-printable chars',
@ -56,6 +56,21 @@ class rc_html2text extends PHPUnit_Framework_TestCase
'in' => '<div>eye: &nbsp;&nbsp;test<br /> tes: &nbsp;&nbsp;test</div>',
'out' => "eye: test\ntes: test",
),
9 => array(
'title' => 'HTML entity in STRONG tag',
'in' => '<strong>&#347;</strong>', // ś
'out' => 'ś',
),
10 => array(
'title' => 'STRONG tag to upper-case conversion',
'in' => '<strong>ś</strong>',
'out' => 'ś',
),
11 => array(
'title' => 'STRONG inside B tag',
'in' => '<b><strong>&#347;</strong></b>',
'out' => 'ś',
),
);
}

Loading…
Cancel
Save