From 923490328786594686e1b782a3fa12ae44ed12c2 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 5 Nov 2015 08:46:43 +0100 Subject: [PATCH] Fix HTML sanitizer to skip in output (#1490583) --- CHANGELOG | 1 + program/lib/Roundcube/rcube_washtml.php | 11 +++-------- tests/Framework/Washtml.php | 6 +++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8283fd1e4..d450dfe06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -48,6 +48,7 @@ CHANGELOG Roundcube Webmail - Fix bug where HTML messages with invalid/excessive css styles couldn't be displayed (#1490539) - Fix redundant blank lines when using HTML and top posting (#1490576) - Fix redundant blank lines on start of text after html to text conversion (#1490577) +- Fix HTML sanitizer to skip in output (#1490583) RELEASE 1.1.3 ------------- diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php index f3b07207b..1b39b58aa 100644 --- a/program/lib/Roundcube/rcube_washtml.php +++ b/program/lib/Roundcube/rcube_washtml.php @@ -313,7 +313,7 @@ class rcube_washtml $dump = ''; do { - switch($node->nodeType) { + switch ($node->nodeType) { case XML_ELEMENT_NODE: //Check element $tagName = strtolower($node->tagName); if ($callback = $this->handlers[$tagName]) { @@ -345,14 +345,9 @@ class rcube_washtml case XML_HTML_DOCUMENT_NODE: $dump .= $this->dumpHtml($node, $level); break; - - case XML_DOCUMENT_TYPE_NODE: - break; - - default: - $dump .= ''; } - } while($node = $node->nextSibling); + } + while($node = $node->nextSibling); return $dump; } diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php index acc611ede..5903d0c0c 100644 --- a/tests/Framework/Washtml.php +++ b/tests/Framework/Washtml.php @@ -47,7 +47,7 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase $html = "

p2

"; $washed = $washer->wash($html); - $this->assertEquals('

p2

', $washed, "HTML conditional comments (#1489004)"); + $this->assertEquals('

p2

', $washed, "HTML conditional comments (#1489004)"); $html = "

para2

"; $washed = $washer->wash($html); - $this->assertEquals('

para1

para2

', $washed, "HTML comments - simple comment"); + $this->assertEquals('

para1

para2

', $washed, "HTML comments - simple comment"); $html = "

para1

para2

"; $washed = $washer->wash($html); - $this->assertEquals('

para1

para2

', $washed, "HTML comments - tags inside (#1489904)"); + $this->assertEquals('

para1

para2

', $washed, "HTML comments - tags inside (#1489904)"); } /**