]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Eml.pm
eml: keep body if no headers are found
[public-inbox.git] / lib / PublicInbox / Eml.pm
index 3c681ba5bc2eb6efc6b0252b67a26ebd2f3b6904..485f637a3e7b41a9117cb37a9acfd8e7649dadfa 100644 (file)
@@ -122,9 +122,10 @@ sub new {
                my $hdr = substr($$ref, 0, $header_size_limit + 1);
                hdr_truncate($hdr) if length($hdr) > $header_size_limit;
                bless { hdr => \$hdr, crlf => $1 }, __PACKAGE__;
-       } else { # nothing useful
-               my $hdr = $$ref = '';
-               bless { hdr => \$hdr, crlf => "\n" }, __PACKAGE__;
+       } else { # just a body w/o header?
+               my $hdr = '';
+               my $eol = ($$ref =~ /(\r?\n)/) ? $1 : "\n";
+               bless { hdr => \$hdr, crlf => $eol, bdy => $ref }, __PACKAGE__;
        }
 }