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

Re: gitweb: using quotemeta

From
Petr Baudis <pasky@suse.cz>
Date
Oct 6, 2006, 13:50 UTC
Message-ID
<20061006135019.GN20017@pasky.or.cz>
In-Reply-To
<20061002201256.89409.qmail@web31809.mail.mud.yahoo.com>

Dear diary, on Mon, Oct 02, 2006 at 10:12:56PM CEST, I got a letter where Luben Tuikov <ltuikov@yahoo.com> said that...

Show 17 quoted lines
> Escaping for the purposes of HTML _view_ and URL generation is ok,
> but it is not ok when _saving_ the file with a file name.
> 
> A file name is just a string of chars, and I want to _save_ the file
> name as its name is. No changes or interpretations please.  I don't
> care what the string is, what chars it is made of, etc.
> 
> Please don't interpret file names and their characters when the files
> are _saved_ by the user's browser.
> 
> The file name in my filesystem should be the exact same file name
> as it appears on any other filesystem hosting the same git repo.
> 
> I don't want this translation:
> Server FS: linux-2.6.git-5c2d97cb31fb77981797fec46230ca005b865799.tar.gz
> Quotemeta: linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz
> User FS: linux\-2\.6\.git\-5c2d97cb31fb77981797fec46230ca005b865799\.tar\.gz
Then the user agent is buggy - which browser exhibits this behaviour?

According to RFC2183, the filename is a value. According to RFC2045, a value is either a token (uninteresting) or a quoted-string. According to RFC822:

     quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or
                                                 ;   quoted chars.
     qtext       =  <any CHAR excepting <">,     ; => may be folded
                     "\" & CR, and including
                     linear-white-space>
     quoted-pair =  "\" CHAR                     ; may quote any char
So what we emit is completely correct.

Of course I have nothing against escaping just ", \ and CR. I don't mind just substituting CR with some other string, but please just quote " and \ correctly.

As of now, gitweb will not handle any filenames containing those three characters properly because of now.

-- 
				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: Jakub NarebskiNext: Luben Tuikov
Message 13 of 14 in “gitweb: using quotemeta”
  1. Luben TuikovSep 28, 2006
  2. Junio C HamanoSep 28, 2006
  3. Luben TuikovSep 28, 2006
  4. Jakub NarebskiOct 2, 2006
  5. Luben TuikovOct 2, 2006
  6. Jakub NarebskiOct 2, 2006
  7. Junio C HamanoOct 3, 2006
  8. Jakub NarebskiOct 6, 2006
  9. Junio C HamanoOct 7, 2006
  10. Jakub NarebskiOct 7, 2006
  11. Luben TuikovOct 7, 2006
  12. Jakub NarebskiOct 11, 2006
  13. Petr BaudisOct 6, 2006
  14. Luben TuikovOct 6, 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.