about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2019-01-15 16:36:42 -0600
committerEric Wong <e@80x24.org>2019-10-15 20:22:44 +0000
commita0ff3e44454322dd35c76a58fba311297ee00218 (patch)
tree38ba87f464504f9f9edb6f453c062af93a2fe98a /lib
parentef821c8882d1eb7c9d31bb76b32e246586a4c3df (diff)
downloadpublic-inbox-a0ff3e44454322dd35c76a58fba311297ee00218.tar.gz
I don't trust the MIME type to not munge my email messages in horrible
ways upon occasion.  Therefore  allow for passing in the raw message
value instead of trusting the mime object to preserve it.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

[ew: use "//" from Perl 5.10+ for defined check]
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/Import.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 137b2b78..e1f48771 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -394,16 +394,16 @@ sub add {
         }
 
         my $blob = $self->{mark}++;
-        my $str = $mime->as_string;
-        my $n = length($str);
+        my $raw_email = $mime->{-public_inbox_raw} // $mime->as_string;
+        my $n = length($raw_email);
         $self->{bytes_added} += $n;
         print $w "blob\nmark :$blob\ndata ", $n, "\n" or wfail;
-        print $w $str, "\n" or wfail;
+        print $w $raw_email, "\n" or wfail;
 
         # v2: we need this for Xapian
         if ($self->{want_object_info}) {
                 my $oid = $self->get_mark(":$blob");
-                $self->{last_object} = [ $oid, $n, \$str ];
+                $self->{last_object} = [ $oid, $n, \$raw_email ];
         }
         my $ref = $self->{ref};
         my $commit = $self->{mark}++;