Ticket #1484391 (closed Bugs: fixed)

Opened 17 months ago

Last modified 6 months ago

DOCTYPE Tag Filtering Fails When Tag Contains CRLF

Reported by: brian Owned by:
Priority: 5 Milestone: 0.2-alpha
Component: Client Scripts Version: svn-trunk
Severity: minor Keywords:
Cc:

Description

r575 added the filtering of !DOCTYPE tags. The regexp used though, doesn't work if the DOCTYPE tag spans multiple lines (has a CRLF in the middle of the <> tags). It removes the first line of the DOCTYPE tag, and then the remainder appears as text in the message.

Sample Email with problem (source):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.
org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

How Code Looks with r575:

<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.-->
org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I updated the code in program/steps/mail/func.inc at line 1211, and the problem has been resolved.

Original lines 1210-1212 (from r575):

  $out = preg_replace(array(
    '/(<!DOCTYPE.+)/i',
    '/(<\/?html[^>]*>)/i',

Modified lines 1210-1212:

  $out = preg_replace(array(
    '/(<\/?!DOCTYPE[^>]*>)/i',
    '/(<\/?html[^>]*>)/i',

Attachments

doctype.diff (460 bytes) - added by lancey 8 months ago.
Patch that fixes the problem
doctypetest.eml (0.8 kB) - added by lancey 8 months ago.
Sample message showing the problem

Change History

Changed 8 months ago by seansan

  • milestone set to 0.1.1

Changed 8 months ago by lancey

Patch that fixes the problem

Changed 8 months ago by lancey

Sample message showing the problem

Changed 6 months ago by alec

  • status changed from new to closed
  • resolution set to fixed

Patch applied in r1307

Note: See TracTickets for help on using tickets.