Ticket #1485139 (closed Patches: fixed)

Opened 4 months ago

Last modified 3 weeks ago

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

Changed 4 months ago by alec

  • component changed from Client Scripts to PHP backend
  • milestone changed from later to 0.2-beta

Changed 4 months ago by thomasb

  • milestone deleted

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

Changed 4 months 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.

Changed 3 weeks ago by alec

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 0.2-beta

We don't need <html> tags at all. Fixed in r1814.

Note: See TracTickets for help on using tickets.