git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] gitweb: Convert Content-Disposition filenames into qtext

From
LTLuben Tuikov <ltuikov@yahoo.com>
Date
Oct 6, 2006, 19:30 UTC
Message-ID
<20061006193059.21334.qmail@web31807.mail.mud.yahoo.com>
In-Reply-To
<20061006192006.GW20017@pasky.or.cz>
--- Petr Baudis <pasky@suse.cz> wrote:
Show 28 quoted lines
> Dear diary, on Fri, Oct 06, 2006 at 09:18:01PM CEST, I got a letter
> where Luben Tuikov <ltuikov@yahoo.com> said that...
> > 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
> > 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?
Yes, \r, not \n.
\n is LF, \r is CR, from ASCII(7).

LF is legal in qtext as defined in RFC 822. The illegals in qtext are CR, backslash and double quote.

   Luben
Show 19 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*',/((..)*)$/)
> 
Previous: Petr BaudisNext: Junio C Hamano
Message 3 of 10 in “gitweb: Convert Content-Disposition filenames into qtext”
  1. gitweb: Convert Content-Disposition filenames into qtextLuben Tuikov, Oct 6, 2006
  2. Petr BaudisOct 6, 2006
  3. Luben TuikovOct 6, 2006
  4. Junio C HamanoOct 7, 2006
  5. Jakub NarebskiOct 7, 2006
  6. Junio C HamanoOct 7, 2006
  7. Luben TuikovOct 7, 2006
  8. Petr BaudisOct 7, 2006
  9. Jakub NarebskiOct 7, 2006
  10. Jakub NarebskiOct 7, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.