Thread (33 messages) flat view 33 messages, 2 authors, 2016-06-15
STALE3732d

[PATCH/RFC v4 08/10] send-email: consider quote as delimiter instead of character

From: Remi Lespinet <hidden>
Date: 2016-06-15 23:05:20
Subsystem: the rest · Maintainer: Linus Torvalds

Do not consider quote inside a recipient name as character when
they are not escaped. This interprets:

  "Jane" "Doe" [off-list ref]

as:

  "Jane Doe" [off-list ref]

instead of:

  "Jane\" \"Doe" [off-list ref]

Signed-off-by: Remi Lespinet <redacted>
---

I don't know if it's an argument for this change, but rfc2822 says:

   Semantically, neither the optional CFWS outside of the quote
   characters nor the quote characters themselves are part of the
   quoted-string...

 git-send-email.perl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index a1f6c18..8594ab9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1078,15 +1078,17 @@ sub sanitize_address {
 		return $recipient;
 	}
 
+	# remove non-escaped quotes
+	$recipient_name =~ s/(^|[^\\])"/$1/g;
+
 	# rfc2047 is needed if a non-ascii char is included
 	if ($recipient_name =~ /[^[:ascii:]]/) {
-		$recipient_name =~ s/^"(.*)"$/$1/;
 		$recipient_name = quote_rfc2047($recipient_name);
 	}
 
 	# double quotes are needed if specials or CTLs are included
 	elsif ($recipient_name =~ /[][()<>@,;:\\".\000-\037\177]/) {
-		$recipient_name =~ s/(["\\\r])/\\$1/g;
+		$recipient_name =~ s/([\\\r])/\\$1/g;
 		$recipient_name = qq["$recipient_name"];
 	}
 
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help