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

Re: [PATCH] gitweb: use correct mime type even if filename has multiple dots.

From
Jakub Narebski <jnareb@gmail.com>
Date
Sep 17, 2006, 08:56 UTC
Message-ID
<eej2i1$97c$1@sea.gmane.org>
In-Reply-To
<7vejua7um3.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 18 quoted lines
>> Looking at /etc/mime.types, it only contains pcf.Z but perhaps
>> it should also contain tar.gz or similiar.
> 
> Probably.  But that makes me think it might be better to:
> 
>  - read in mime.types, sort the entries with length of the
>    suffixes (longer first);
> 
>  - try matching the suffixes from longer to shorter and pick the
>    first match.
> 
> Without that, you would not be able to cope with a /etc/mime.types
> that looks like this, no?
> 
>         application/a   a
>         application/b   b.a
> 
> Perhaps something like the attached.

Is it really useful? Usually the suffix in mime.types doesn't contain dot itself. Besides, to be said we need correct mimetype only for files which can be displayed in browser (HTML, XHTML, images: png, gif, jpeg, perhaps XML). All other can get generic mimetype, i.e. application/octet-stream for binary files (to be saved) and text/plain for text file (to be displayer as-is in browser).

Besides, performance will suffer for "blob_plain" view. One hash lookup vs. nested loops.

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 10 in “gitweb: use correct mime type even if filename has multiple dots.”
  1. gitweb: use correct mime type even if filename has multiple dots.Martin Waitz, Sep 16, 2006
  2. Jakub NarebskiSep 16, 2006
  3. Martin WaitzSep 17, 2006
  4. Jakub NarebskiSep 17, 2006
  5. Martin WaitzSep 19, 2006
  6. gitweb: Fix mimetype_guess_file for files with multiple extensionsJakub Narebski, Sep 19, 2006
  7. Junio C HamanoSep 17, 2006
  8. Jakub NarebskiSep 17, 2006
  9. Junio C HamanoSep 17, 2006
  10. Martin WaitzSep 19, 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.