Re: [PATCH] gitweb: Convert Content-Disposition filenames into qtext
- From
Petr Baudis <pasky@suse.cz>
- Date
- Oct 6, 2006, 19:20 UTC
- Message-ID
- <20061006192006.GW20017@pasky.or.cz>
- In-Reply-To
- <20061006191801.68649.qmail@web31815.mail.mud.yahoo.com>
Dear diary, on Fri, Oct 06, 2006 at 09:18:01PM CEST, I got a letter where Luben Tuikov <ltuikov@yahoo.com> said that...
Show 7 quoted lines
> Convert a string (e.g. a filename) into qtext as defined > in RFC 822, from RFC 2183. To be used by Content-Disposition. > > Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> > --- > gitweb/gitweb.perl | 18 ++++++++++++++---- > 1 files changed, 14 insertions(+), 4 deletions(-)
Content-Description: 1207600725-p1.txt
Show 15 quoted lines
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index f848648..a35d02c 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -520,6 +520,16 @@ sub esc_html {
> return $str;
> }
>
> +# Convert a string (e.g. a filename) into qtext as defined
> +# in RFC 822, from RFC 2183. To be used by Content-Disposition.
> +sub to_qtext {
> + my $str = shift;
> + $str =~ s/\\/\\\\/g;
> + $str =~ s/\"/\\\"/g;
> + $str =~ s/\r/\\r/g;\r? Not \n?
Show 6 quoted lines
> + return $str;
> +}
> +
> # git may return quoted and escaped filenames
> sub unquote {
> my $str = shift;Other than that,
Acked-by: Petr Baudis <pasky@suse.cz>
--
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*',/((..)*)$/)