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 7, 2006, 18:01 UTC
Message-ID
<20061007180115.59728.qmail@web31814.mail.mud.yahoo.com>
In-Reply-To
<7vvemwqusl.fsf@assigned-by-dhcp.cox.net>
--- Junio C Hamano <junkio@cox.net> wrote:
Show 28 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
> 
> > Junio C Hamano wrote:
> >
> >> Luben Tuikov <ltuikov@yahoo.com> writes:
> >> 
> >>>>> +# 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;
> >
> > Here probably it could be
> >         $str =~ s/"/\\"/g;
> >
> >>>>> +  $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".
> 
> Is that what you guys are attempting to achieve?
I think so.
Show 6 quoted lines
> If we are trying to suggest a filename that is safe by avoiding
> certain characters, I suspect leaving a backslash and dq as-is
> is just as bad as leaving a CR in.  So if that is the goal here,
> I think it might be better and a lot simpler to just replace
> each run of bytes not in Portable Filename Character Set with an
> underscore '_'.

I think that if I were to download a file which had those chars in it, I'd like to at least be able to see the _intention_ of what chars the actual file name had.

So if I download a filename which looks like this:
     This is a \" test \" file \\.\r
Then I know that the intention had been:
     This is a " test " file \.<CR>

It becomes an intention, since it needs to be carried over a qtext.

   Luben
Previous: Junio C HamanoNext: Petr Baudis
Message 7 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.