Date: Tue, 15 Jan 2019 16:36:42 -0600

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" <[email protected]>
---

As we discussed last time I was working to merge my imap import script.

 lib/PublicInbox/Import.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 137b2b7800c4..b17c9d5c9fa8 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -394,16 +394,17 @@ sub add {
        }
 
        my $blob = $self->{mark}++;
-       my $str = $mime->as_string;
-       my $n = length($str);
+       my $raw_email = $mime->{-public_inbox_raw};
+       $raw_email ||= $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}++;
-- 
2.23.0

--
unsubscribe: [email protected]
archive: https://public-inbox.org/meta/

Reply via email to