Ticket #1485139 (closed Patches: fixed)
Closing html tags end message parsing
| Reported by: | brian | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.2-beta |
| Component: | PHP backend | Version: | 0.2-alpha |
| Severity: | normal | Keywords: | |
| Cc: |
Description
The update to the washtml library prevents parsing after the first closing 'html' tag is found. This can cause problems as some emails contain embedded html code.
For example:
<html><body>
Message starts here
<html><body>
Embedded Message starts here
</body></html>
Rest of original message is here
</body></html>
In the above example, the "Rest of original message is here" will not appear in roundcube. I have remediated this by stripping all closing html tags and placing one at the end.
In the folder: /program/steps/mail In the file: func.inc using r1533 the following line was added (lines 542-545 displayed):
// add <head> for malformed messages, washtml cannot work without that
if (!preg_match('/<head>(.*)<\/head>/m', $html))
$html = '<head></head>' . $html;
$html = preg_replace('/<\/html>/i', '', $html).'</html>';
$html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '</head>')), 0);
This is the new line in the code above:
$html = preg_replace('/<\/html>/i', '', $html).'</html>';
Change History
Note: See
TracTickets for help on using
tickets.
