Skip to content

Commit 5983ddc

Browse files
committed
Merge branch 'bc/send-email-qp-cr'
"git send-email" has been taught to use quoted-printable when the payload contains carriage-return. The use of the mechanism is in line with the design originally added the codepath that chooses QP when the payload has overly long lines. * bc/send-email-qp-cr: send-email: default to quoted-printable when CR is present
2 parents f1c9f6c + 74d76a1 commit 5983ddc

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

git-send-email.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ sub apply_transfer_encoding {
18721872
$message = MIME::Base64::decode($message)
18731873
if ($from eq 'base64');
18741874

1875-
$to = ($message =~ /.{999,}/) ? 'quoted-printable' : '8bit'
1875+
$to = ($message =~ /(?:.{999,}|\r)/) ? 'quoted-printable' : '8bit'
18761876
if $to eq 'auto';
18771877

18781878
die __("cannot send message as 7bit")

t/t9001-send-email.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,20 @@ test_expect_success $PREREQ 'long lines with auto encoding are quoted-printable'
481481
grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
482482
'
483483

484+
test_expect_success $PREREQ 'carriage returns with auto encoding are quoted-printable' '
485+
clean_fake_sendmail &&
486+
cp $patches cr.patch &&
487+
printf "this is a line\r\n" >>cr.patch &&
488+
git send-email \
489+
--from="Example <[email protected]>" \
490+
491+
--smtp-server="$(pwd)/fake.sendmail" \
492+
--transfer-encoding=auto \
493+
--no-validate \
494+
cr.patch &&
495+
grep "Content-Transfer-Encoding: quoted-printable" msgtxt1
496+
'
497+
484498
for enc in auto quoted-printable base64
485499
do
486500
test_expect_success $PREREQ "--validate passes with encoding $enc" '

0 commit comments

Comments
 (0)