Re: [PATCH] send-email: Honor multi-part email messages

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

 



> Alexey Shumkin <zapped@xxxxxxx> writes:
> 
> > diff --git a/git-send-email.perl b/git-send-email.perl
> > index 98ab33a..1abf4a4 100755
> > --- a/git-send-email.perl
> > +++ b/git-send-email.perl
> > @@ -1403,12 +1403,17 @@ sub file_has_nonascii {
> >  
> >  sub body_or_subject_has_nonascii {
> >  	my $fn = shift;
> > +	my $multipart = 0;
> >  	open(my $fh, '<', $fn)
> >  		or die "unable to open $fn: $!\n";
> >  	while (my $line = <$fh>) {
> >  		last if $line =~ /^$/;
> > +		if ($line
> > =~ /^Content-Type:\s*multipart\/mixed.*$/) {
> > +			$multipart = 1;
> > +		}
> >  		return 1 if $line =~ /^Subject.*[^[:ascii:]]/;
> >  	}
> > +	return 0 if $multipart;
> 
> Looks as if you can lose the extra variable and return 0 immediately
> when you find a line with that Content-Type inside the loop.
Well, as I understand "current" algorithm:
1. It assumes that file is one-part email message
2. Function searches non-ASCII characters in Subject header
3. If none then it looks non-ASCII characters at message body

my changes are to skip looking at message body of a multi-part
message as it has parts with their own Content-Type headers

The said above in details:
1. To set flag when we meet Content-Type: multipart/mixed header
2. After we processed all headers and did not found non-ASCII characters
in a Subject we take a look at this flag and exit with 0
if it is a multi-part message
--
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]