You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2004/01/12 00:54:09 UTC

svn commit: rev 6142 - incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MIME

Author: felicity
Date: Sun Jan 11 15:54:08 2004
New Revision: 6142

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MIME/Parser.pm
Log:
we need to render text/html or text/* that looks like HTML ...


Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MIME/Parser.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MIME/Parser.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/MIME/Parser.pm	Sun Jan 11 15:54:08 2004
@@ -360,7 +360,7 @@
 	raw_headers => $part_msg->{raw_headers},
   };
   $opts->{name} = $name if $name;
-  $opts->{rendered} = _render_text($decoded) if $type =~ m/^text/i;
+  $opts->{rendered} = _render_text($type, $decoded) if $type =~ m/^text/i;
 
   $msg->add_body_part( $type, $opts );
 }
@@ -429,15 +429,18 @@
 }
 
 sub _render_text {
-  my ($decoded) = @_;
+  my ($type, $decoded) = @_;
 
   my $text = join('', @{ $decoded });
 
-  # render text/plain as text/html based on a heuristic which simulates
-  # a certain common mail client
-  if ($text =~ m/^(.{0,18}?<(?:$Mail::SpamAssassin::HTML::re_start)(?:\s.{0,18}?)?>)/ois &&
-      html_near_start($1))
-  {
+  # render text/html always, or any other text part as text/html based
+  # on a heuristic which simulates a certain common mail client
+  if ( $type =~ m@^text/html$@i ||
+      ($type =~ m@^text/@i &&
+        $text =~ m/^(.{0,18}?<(?:$Mail::SpamAssassin::HTML::re_start)(?:\s.{0,18}?)?>)/ois &&
+	html_near_start($1)
+      )
+     ) {
     my $html = Mail::SpamAssassin::HTML->new();		# object
     my $html_rendered = $html->html_render($text);	# rendered text
     my $html_results = $html->get_results();		# needed in eval tests