Aleksander Machniak
2015-08-10 ca7fc75bec34ab7c839f3a3f3ec14872110f4a86
Fix "washing" of style elements wrapped into many lines
3 files modified
12 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_washtml.php 3 ●●●●● patch | view | raw | blame | history
tests/Framework/Washtml.php 8 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -26,6 +26,7 @@
- Fix error when using back button after sending an email (#1490009)
- Fix removing signature when switching to identity with an empty sig in HTML mode (#1490470)
- Disable links list generation on html-to-text conversion of identities or composed message (#1490437)
- Fix "washing" of style elements wrapped into many lines
RELEASE 1.1.2
-------------
program/lib/Roundcube/rcube_washtml.php
@@ -174,6 +174,9 @@
    {
        $result = array();
        // Remove unwanted white-space characters so regular expressions below work better
        $style = preg_replace('/[\n\r\s\t]+/', ' ', $style);
        foreach (explode(';', $style) as $declaration) {
            if (preg_match('/^\s*([a-z\-]+)\s*:\s*(.*)\s*$/i', $declaration, $match)) {
                $cssid = $match[1];
tests/Framework/Washtml.php
@@ -182,6 +182,14 @@
        $this->assertRegExp('|line-height: 1;|', $washed, "Untouched line-height (#1489917)");
        $this->assertRegExp('|; height: 10px|', $washed, "Fixed height units");
        $html     = "<div style=\"padding: 0px\n   20px;border:1px solid #000;\"></div>";
        $expected = "<div style=\"padding: 0px 20px; border: 1px solid #000\"></div>";
        $washer = new rcube_washtml;
        $washed = $washer->wash($html);
        $this->assertTrue(strpos($washed, $expected) !== false, "White-space and new-line characters handling");
    }
    /**