Eric Wong <normalper...@yhbt.net> writes:

> -                      # commas delimit multiple addresses
> -                     $aliases{$alias} = [ split_addrs($addr) ];
> +                     # commas delimit multiple addresses
> +                     my @addr = split_addrs($addr);
> +
> +                     # quotes may be escaped in the file,
> +                     # remove them if paired so we do not
> +                     # double-escape them later.
> +                     s/^\\"(.*)\\"/"$1"/g foreach @addr;
> +                     $aliases{$alias} = \@addr

Can one address have two or more double-quoted string pieces in it?
If that is possible, (.*) above might want to become (.*?) or even
([^"]*) to make it less greedy, perhaps?

>               }}},
>       mailrc => sub { my $fh = shift; while (<$fh>) {
>               if (/^alias\s+(\S+)\s+(.*)$/) {
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index 3c49536..834d91a 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -1527,6 +1527,21 @@ test_expect_success $PREREQ 'cccover adds Cc to all 
> mail' '
>       test_cover_addresses "Cc"
>  '
>  
> +test_expect_success $PREREQ 'escaped quotes in sendemail.aliasfiletype=mutt' 
> '
> +     clean_fake_sendmail &&
> +     echo "alias sbd \\\"Dot U. Sir\\\" <someb...@example.org>" >.mutt &&
> +     git config --replace-all sendemail.aliasesfile "$(pwd)/.mutt" &&
> +     git config sendemail.aliasfiletype mutt &&
> +     git send-email \
> +             --from="Example <nob...@example.com>" \
> +             --to=sbd \
> +             --smtp-server="$(pwd)/fake.sendmail" \
> +             outdir/0001-*.patch \
> +             2>errors >out &&
> +     grep "^!somebody@example\.org!$" commandline1 &&
> +     grep -F "To: \"Dot U. Sir\" <someb...@example.org>" out
> +'
> +
>  test_expect_success $PREREQ 'sendemail.aliasfiletype=mailrc' '
>       clean_fake_sendmail &&
>       echo "alias sbd  someb...@example.org" >.mailrc &&
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to