Opened 5 years ago
Closed 5 years ago
#1485139 closed Feature 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 (4)
comment:1 Changed 5 years ago by alec
- Component changed from Client Scripts to PHP backend
- Milestone changed from later to 0.2-beta
comment:2 Changed 5 years ago by thomasb
- Milestone 0.2-beta deleted
comment:3 Changed 5 years ago by brian
While I agree that malformed HTML is a bad thing. The email I had with this issue displayed properly in Apple Mail, Outlook Express, GMail, and Roundcube 0.1.1, but not in Roundcube in SVN (after the washtml modification). The specific problem was two sets of </html> closing tags.
Not implementing this in 0.2 will reduce the functionality of roundcube with regards to improperly formatted emails.
comment:4 Changed 5 years ago by alec
- Milestone set to 0.2-beta
- Resolution set to fixed
- Status changed from new to closed
We don't need <html> tags at all. Fixed in [2cb6d48e].

Malformed HTML should be avoided. We'll keep this a patch but will not commit it to trunk.