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" <jdoe@example.com> as: "Jane Doe" <jdoe@example.com> instead of: "Jane\" \"Doe" <jdoe@example.com> Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Remi Lespinet committed
Jun 30, 2015 at 14:16 UTC
1fe9703f08cfac8bd2db7a17bb6f3a61cf20ef35
1 file changed
+4
-2
git-send-email.perl
+4
-2
@@ -1003,15 +1003,17 @@ sub sanitize_address {
1003
return $recipient;
1004
}
1005
1006
+ # remove non-escaped quotes
1007
+ $recipient_name =~ s/(^|[^\\])"/$1/g;
1008
+
1009
# rfc2047 is needed if a non-ascii char is included
1010
if ($recipient_name =~ /[^[:ascii:]]/) {
1008
- $recipient_name =~ s/^"(.*)"$/$1/;
1011
$recipient_name = quote_rfc2047($recipient_name);
1012
}
1013
1014
# double quotes are needed if specials or CTLs are included
1015
elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) {
1014
- $recipient_name =~ s/(["\\\r])/\\$1/g;
1016
+ $recipient_name =~ s/([\\\r])/\\$1/g;
1017
$recipient_name = qq["$recipient_name"];
1018
}
1019