From 74d76a17013411d72ebda7c230b9898f3adb1fcc Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Sat, 13 Apr 2019 22:45:51 +0000 Subject: send-email: default to quoted-printable when CR is present In 7a36987fff ("send-email: add an auto option for transfer encoding", 2018-07-08), git send-email learned how to automatically determine the transfer encoding for a patch. However, the only criterion considered was the length of the lines. Another case we need to consider is that of carriage returns. Because emails have CRLF endings when canonicalized, we don't want to write raw carriage returns into a patch, lest they be stripped off as an artifact of the transport. Ensure that we choose quoted-printable encoding if the patch we're sending contains carriage returns. Note that we are guaranteed to always correctly encode carriage returns when writing quoted-printable since we explicitly specify the line ending as "\n", forcing MIME::QuotedPrint to encode our carriage return as "=0D". Signed-off-by: brian m. carlson Signed-off-by: Junio C Hamano --- git-send-email.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-send-email.perl') diff --git a/git-send-email.perl b/git-send-email.perl index 8eb63b5a2f..3f66e1cdc2 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -1866,7 +1866,7 @@ sub apply_transfer_encoding { $message = MIME::Base64::decode($message) if ($from eq 'base64'); - $to = ($message =~ /.{999,}/) ? 'quoted-printable' : '8bit' + $to = ($message =~ /(?:.{999,}|\r)/) ? 'quoted-printable' : '8bit' if $to eq 'auto'; die __("cannot send message as 7bit") -- cgit v1.2.3