Re: [PATCH] make git-send-email.perl handle email addresses with no names when Email::Valid is present

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greg KH <greg@xxxxxxxxx> writes:

> When using git-send-email.perl on a changeset that has:
> 	Cc: <stable@xxxxxxxxxx>
> in the body of the description, and the Email::Valid perl module is
> installed on the system, the email address will be deemed "invalid" for
> some reason (Email::Valid isn't smart enough to handle this?) and
> complain and not send the address the email.

That appears to be the case.

        bad foo
        bad <foo@xxxxxxx>
        ok  foo@xxxxxxx
        ok  Foo <foo@xxxxxxx>

> Anyway, this tiny patch fixes this problem for me.  Note, my perl-foo is
> quite week, so this could probably be easily done in one line for those
> with better reg-ex skills.

> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -410,6 +410,9 @@ sub extract_valid_address {
>  	return $address if ($address =~ /^($local_part_regexp)$/);
>  
>  	if ($have_email_valid) {
> +		if ($address =~ s/^<//) {
> +			$address =~ s/>$//;
> +		}
>  		return scalar Email::Valid->address($address);
>  	} else {

I'd probably do:

	if ($have_email_valid) {
		$address =~ s/^<(.*)>$/$1/;
		return scalar Email::Valid->address($address);
	} else {

instead, but they are moral equivalents.

Thanks for a fix.


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux