From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 941022142E for ; Mon, 21 Jan 2019 20:53:00 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 31/37] solver: force quoted-printable bodies to LF Date: Mon, 21 Jan 2019 20:52:47 +0000 Message-Id: <20190121205253.10455-32-e@80x24.org> In-Reply-To: <20190121205253.10455-1-e@80x24.org> References: <20190121205253.10455-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: ..if the Email::MIME ->crlf is LF. Email::MIME::Encodings forces everything to CRLF on quoted-printable messages for RFC-compliance; and git-apply --ignore-whitespace seems to miss a context line which is just "\r\n" (w/o leading space). --- lib/PublicInbox/SolverGit.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index 8fde232..612f495 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -78,6 +78,14 @@ sub extract_diff ($$$$) { my ($s, undef) = msg_part_text($part, $ct); defined $s or return; my $di = {}; + + # Email::MIME::Encodings forces QP to be CRLF upon decoding, + # change it back to LF: + my $cte = $part->header('Content-Transfer-Encoding') || ''; + if ($cte =~ /\bquoted-printable\b/i && $part->crlf eq "\n") { + $s =~ s/\r\n/\n/sg; + } + foreach my $l (split(/^/m, $s)) { if ($l =~ $re) { $di->{oid_a} = $1; -- EW