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

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

From
Jakub Narebski <jnareb@gmail.com>
Date
Oct 7, 2006, 12:11 UTC
Message-ID
<eg85ga$9g6$1@sea.gmane.org>
In-Reply-To
<20061007114602.GX20017@pasky.or.cz>
Petr Baudis wrote:
Show 26 quoted lines
> Dear diary, on Sat, Oct 07, 2006 at 12:06:31PM CEST, I got a letter
> where Jakub Narebski <jnareb@gmail.com> said that...
>> >>>> +  $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.
Bu the way, using the following script:

-- >8 -- #!/usr/bin/perl

use strict; use warnings; use CGI qw(:standard :escapeHTML -nosticky);

binmode STDOUT, ':utf8';
our $cgi = new CGI;
print $cgi->header(
        -type => 'text/plain',
        -charset => 'utf-8',
        -content_disposition => 'inline; filename="test\".\\"test\\n.\\\n"');

print "TEST\n"; -- >8 --

I've checked that at least Mozilla 1.7.12 wants to using "\n" in file name instead of literal eoln.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Petr BaudisNext: Jakub Narebski
Message 9 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.