Re: [PATCH] gitweb: Convert Content-Disposition filenames into qtext
- From
Petr Baudis <pasky@suse.cz>
- Date
- Oct 7, 2006, 11:46 UTC
- Message-ID
- <20061007114602.GX20017@pasky.or.cz>
- In-Reply-To
- <eg7u5n$mt9$1@sea.gmane.org>
Dear diary, on Sat, Oct 07, 2006 at 12:06:31PM CEST, I got a letter where Jakub Narebski <jnareb@gmail.com> said that...
Show 10 quoted lines
> >>>> + $str =~ s/\r/\\r/g; > >>> > >>> \r? Not \n? > >> > >> Yes, \r, not \n. > > > > \r to \\r? Not to \\\r? > > We want "\r" in suggested filename, not "\ > " I think, so it is "\\r".
Oh, yes. Lubin wants. It looked sane until I've read it as you explicitly wrote it. ;-)
That's "obviously" wrong. In qtext, \r means just r, no special interpretation is done. So we indeed _would_ want "\ ". Which is of course a nice trap for buggy browsers so in fact we obviously do not want that. I think it's not wort the potential problems to try to carry newlines in the header, so I would just replace that line with
$str =~ s/[\n\r]/_/g;
as per Junio's suggestion.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)