From: Eric Wong Date: Thu, 13 Nov 2014 21:20:29 +0000 (+0000) Subject: view: account for filter bugs which leak HTML into the repo X-Git-Tag: v1.0.0~1098 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=75f6b34d08825b8d80de1ceda2a37e18ddde75a6;p=public-inbox.git view: account for filter bugs which leak HTML into the repo Ugh, apparently there's a (yet-to-be-fixed) bug in the Filter code which caused an HTML message portion of a multipart message to be displayed on the web UI. Account for that and nuke it. --- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index e76d904e..b09c3ba1 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -104,7 +104,12 @@ sub index_entry { $mime->walk_parts(sub { my ($part) = @_; return if $part->subparts; # walk_parts already recurses - my $enc = enc_for($part->content_type) || $enc_msg || $enc_utf8; + my $ct = $part->content_type; + + # account for filter bugs... + return if defined $ct && $ct =~ m!\btext/[xh]+tml\b!i; + + my $enc = enc_for($ct) || $enc_msg || $enc_utf8; if ($part_nr > 0) { my $fn = $part->filename; @@ -178,7 +183,12 @@ sub multipart_text_as_html { $mime->walk_parts(sub { my ($part) = @_; return if $part->subparts; # walk_parts already recurses - my $enc = enc_for($part->content_type) || $enc_msg || $enc_utf8; + my $ct = $part->content_type; + + # account for filter bugs... + return if defined $ct && $ct =~ m!\btext/[xh]+tml\b!i; + + my $enc = enc_for($ct) || $enc_msg || $enc_utf8; if ($part_nr > 0) { my $fn = $part->filename;