summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorРоман Донченко <dpb@corrigendum.ru>2014-12-14 15:59:47 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-12-15 17:06:40 (GMT)
commitab47e2a583917ecef5da269cc640f8359c8467ac (patch)
tree45104be9f5463dd7998e4f4f096d998b646a037f /git-send-email.perl
parent11f70a7e29ff7167e89aad186d763a4b017e48d9 (diff)
downloadgit-ab47e2a583917ecef5da269cc640f8359c8467ac.zip
git-ab47e2a583917ecef5da269cc640f8359c8467ac.tar.gz
git-ab47e2a583917ecef5da269cc640f8359c8467ac.tar.bz2
send-email: handle adjacent RFC 2047-encoded words properly
The RFC says that they are to be concatenated after decoding (i.e. the intervening whitespace is ignored). Signed-off-by: Роман Донченко <dpb@corrigendum.ru> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl26
1 files changed, 16 insertions, 10 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index 106c2b0..cd327d7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -912,17 +912,23 @@ $time = time - scalar $#files;
sub unquote_rfc2047 {
local ($_) = @_;
my $charset;
- s{$re_encoded_word}{
- $charset = $1;
- my $encoding = $2;
- my $text = $3;
- if ($encoding eq 'q' || $encoding eq 'Q') {
- $text =~ s/_/ /g;
- $text =~ s/=([0-9A-F]{2})/chr(hex($1))/egi;
- $text;
- } else {
- $&; # other encodings not supported yet
+ my $sep = qr/[ \t]+/;
+ s{$re_encoded_word(?:$sep$re_encoded_word)*}{
+ my @words = split $sep, $&;
+ foreach (@words) {
+ m/$re_encoded_word/;
+ $charset = $1;
+ my $encoding = $2;
+ my $text = $3;
+ if ($encoding eq 'q' || $encoding eq 'Q') {
+ $_ = $text;
+ s/_/ /g;
+ s/=([0-9A-F]{2})/chr(hex($1))/egi;
+ } else {
+ # other encodings not supported yet
+ }
}
+ join '', @words;
}eg;
return wantarray ? ($_, $charset) : $_;
}