From 00cc13a1b939e4463d6cae2a603688e909d6fc1b Mon Sep 17 00:00:00 2001 From: dsoares Date: Tue, 26 Mar 2019 15:10:43 +0000 Subject: [PATCH 1/2] Fix bug where HTML messages with a xml:namespace tag were not rendered. --- program/lib/Roundcube/rcube_washtml.php | 3 +++ tests/Framework/Washtml.php | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php index 497a1c3e4..dfb57cac2 100644 --- a/program/lib/Roundcube/rcube_washtml.php +++ b/program/lib/Roundcube/rcube_washtml.php @@ -605,6 +605,8 @@ class rcube_washtml '/^(\0\0\xFE\xFF|\xFF\xFE\0\0|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/', // washtml/DOMDocument cannot handle xml namespaces '/]+>/i', + // washtml/DOMDocument cannot handle xml namespaces + '/<\?xml:namespace\s[^>]+>/i', ); $html_replace = array( @@ -613,6 +615,7 @@ class rcube_washtml '', '', '', + '', ); $html = preg_replace($html_search, $html_replace, $html); diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php index eebd80de5..1dbb87a93 100644 --- a/tests/Framework/Washtml.php +++ b/tests/Framework/Washtml.php @@ -430,4 +430,18 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase $this->assertContains('for="testmy-other-id"', $washed); $this->assertContains('class="testmy-class1 testmy-class2"', $washed); } + + /** + * Test removing xml:namespace tag + */ + function test_xml_namespace() + { + $html = '

'; + + $washer = new rcube_washtml; + $washed = $this->cleanupResult($washer->wash($html)); + + $this->assertNotContains('<?xml:namespace"', $washed); + $this->assertSame($washed, '

'); + } } From a07c44804a20d0e8d033030d548dc0a79d1fa189 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 7 Apr 2019 08:22:01 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index c6dac6cc7..cd6db45e7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ CHANGELOG Roundcube Webmail - Elastic: Add hide/show for advanced preferences (#6632) - Elastic: Fix bug where toolbar disappears on attachment menu use in Chrome (#6677) - Elastic: Fix folders list scrolling on touch devices (#6706) +- Fix bug where HTML messages with a xml:namespace tag were not rendered (#6697) - Fix TinyMCE download location (#6694) - Fix so "Open in new window" consistently displays "external window" interface (#6659) - Fix bug where next row wasn't selected after deleting a collapsed thread (#6655)