]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: all content is assumed to be displayable text
authorEric Wong <e@80x24.org>
Sun, 6 Apr 2014 06:50:08 +0000 (06:50 +0000)
committerEric Wong <e@80x24.org>
Sun, 6 Apr 2014 06:50:08 +0000 (06:50 +0000)
Our Filter class now passes through application/octet-stream
if it looks like text (because some mailers suck); so we
cannot trust the specified Content-Type of a message.

lib/PublicInbox/View.pm

index 3f3fea5a36e35f4f18c0b5a7e213abe751ef5a31..aea0dd1c3762ad208c038c0b3432531ee00b2e2c 100644 (file)
@@ -29,27 +29,20 @@ sub multipart_text_as_html {
                my ($part) = @_;
                return if $part->subparts; # walk_parts already recurses
 
-               my $part_type = $part->content_type;
-               if ($part_type =~ m!\btext/[a-z0-9\+\._-]+\b!i) {
-                       my $fn = $part->filename;
-
-                       if ($part_nr > 0) {
-                               defined($fn) or $fn = "part #" . ($part_nr + 1);
-                               $rv .= add_filename_line($fn);
-                       }
-
-                       if (defined $full_pfx) {
-                               $rv .= add_text_body_short($part, $part_nr,
-                                                       $full_pfx);
-                       } else {
-                               $rv .= add_text_body_full($part, $part_nr);
-                       }
-                       $rv .= "\n" unless $rv =~ /\n\z/s;
+               my $fn = $part->filename;
+
+               if ($part_nr > 0) {
+                       defined($fn) or $fn = "part #" . ($part_nr + 1);
+                       $rv .= add_filename_line($fn);
+               }
+
+               if (defined $full_pfx) {
+                       $rv .= add_text_body_short($part, $part_nr,
+                                               $full_pfx);
                } else {
-                       $rv .= "-- part #" . ($part_nr + 1) . " ";
-                       $rv .= escapeHTML($part_type);
-                       $rv .= " skipped\n";
+                       $rv .= add_text_body_full($part, $part_nr);
                }
+               $rv .= "\n" unless $rv =~ /\n\z/s;
                ++$part_nr;
        });
        $rv;