]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Filter.pm
constent X?HTML MIME type filtering
[public-inbox.git] / lib / PublicInbox / Filter.pm
index 0b1ec911407d3fa60ed9b1a3cdcf9ab6023b2641..84df0e7d64669245b68584dd625023aef61fc326 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2013, Eric Wong <normalperson@yhbt.net> and all contributors
+# Copyright (C) 2013-2015 all contributors <meta@public-inbox.org>
 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
 #
 # This only exposes one function: run
@@ -16,7 +16,7 @@ use constant NO_HTML => '*** We only accept plain-text email, no HTML ***';
 
 # start with the same defaults as mailman
 our $BAD_EXT = qr/\.(exe|bat|cmd|com|pif|scr|vbs|cpl|zip)\s*\z/i;
-our $MIME_HTML = qr!\btext/html\b!i;
+our $MIME_HTML = qr!\btext/x?html\b!i;
 our $MIME_TEXT_ANY = qr!\btext/[a-z0-9\+\._-]+\b!i;
 
 # this is highly opinionated delivery
@@ -211,7 +211,7 @@ sub collapse {
        $mime->header_set('Content-Type', $part->content_type);
        $mime->body_set($part->body_raw);
        my $cte = $part->header('Content-Transfer-Encoding');
-       if (defined($cte) && length($cte)) {
+       if (defined($cte) && $cte ne '') {
                $mime->header_set('Content-Transfer-Encoding', $cte);
        }
        mark_changed($mime);