]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Eml.pm
update copyrights for 2021
[public-inbox.git] / lib / PublicInbox / Eml.pm
index 1fecd41be9f4b1f2d11d4591918935ac9b1aba16..462d51fc0cbcd118770abc2ba8bbe0af9fea1008 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # Lazy MIME parser, it still slurps the full message but keeps short
@@ -129,7 +129,7 @@ sub new {
 sub new_sub {
        my (undef, $ref) = @_;
        # special case for messages like <85k5su9k59.fsf_-_@lola.goethe.zz>
-       $$ref =~ /\A(\r?\n)/s or goto &new;
+       $$ref =~ /\A(\r?\n)/s or return new(undef, $ref);
        my $hdr = substr($$ref, 0, $+[0], ''); # sv_chop on $$ref
        bless { hdr => \$hdr, crlf => $1, bdy => $ref }, __PACKAGE__;
 }
@@ -378,7 +378,9 @@ sub header_str_set {
        header_set($self, $name, @vals);
 }
 
-sub mhdr_decode ($) { eval { $MIME_Header->decode($_[0]) } // $_[0] }
+sub mhdr_decode ($) {
+       eval { $MIME_Header->decode($_[0], Encode::FB_DEFAULT) } // $_[0];
+}
 
 sub filename {
        my $dis = header_raw($_[0], 'Content-Disposition');