Fix handling link href attribute value with (valid) newline characters (#1488940)
| | |
| | | $value = $node->getAttribute($key); |
| | | |
| | | if (isset($this->_html_attribs[$key]) || |
| | | ($key == 'href' && !preg_match('!^(javascript|vbscript|data:text)!i', $value) |
| | | ($key == 'href' && ($value = trim($value)) |
| | | && !preg_match('!^(javascript|vbscript|data:text)!i', $value) |
| | | && preg_match('!^([a-z][a-z0-9.+-]+:|//|#).+!i', $value)) |
| | | ) { |
| | | $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; |
| | |
| | | $this->assertNotRegExp('/vbscript:/', $washed, "Remove vbscript: links"); |
| | | } |
| | | |
| | | /** |
| | | * Test fixing of invalid href (#1488940) |
| | | */ |
| | | function test_href() |
| | | { |
| | | $html = "<p><a href=\"\nhttp://test.com\n\">Firefox</a>"; |
| | | |
| | | $washer = new rcube_washtml; |
| | | |
| | | $washed = $washer->wash($html); |
| | | |
| | | $this->assertRegExp('|href="http://test.com">|', $washed, "Link href with newlines (#1488940)"); |
| | | } |
| | | |
| | | } |