Skip to content

Commit 1fe9703

Browse files
Awaryngitster
authored andcommitted
send-email: consider quote as delimiter instead of character
Do not consider quote inside a recipient name as character when they are not escaped. This interprets: "Jane" "Doe" <[email protected]> as: "Jane Doe" <[email protected]> instead of: "Jane\" \"Doe" <[email protected]> Signed-off-by: Remi Lespinet <[email protected]> Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8d314d7 commit 1fe9703

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

git-send-email.perl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,15 +1003,17 @@ sub sanitize_address {
10031003
return $recipient;
10041004
}
10051005

1006+
# remove non-escaped quotes
1007+
$recipient_name =~ s/(^|[^\\])"/$1/g;
1008+
10061009
# rfc2047 is needed if a non-ascii char is included
10071010
if ($recipient_name =~ /[^[:ascii:]]/) {
1008-
$recipient_name =~ s/^"(.*)"$/$1/;
10091011
$recipient_name = quote_rfc2047($recipient_name);
10101012
}
10111013

10121014
# double quotes are needed if specials or CTLs are included
10131015
elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) {
1014-
$recipient_name =~ s/(["\\\r])/\\$1/g;
1016+
$recipient_name =~ s/([\\\r])/\\$1/g;
10151017
$recipient_name = qq["$recipient_name"];
10161018
}
10171019

0 commit comments

Comments
 (0)