git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: use correct mime type even if filename has multiple dots.
Date: Sun, 17 Sep 2006 10:56:10 +0200	[thread overview]
Message-ID: <eej2i1$97c$1@sea.gmane.org> (raw)
In-Reply-To: 7vejua7um3.fsf@assigned-by-dhcp.cox.net

Junio C Hamano wrote:

>> 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

  reply	other threads:[~2006-09-17  8:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-16 21:09 [PATCH] gitweb: use correct mime type even if filename has multiple dots Martin Waitz
2006-09-16 21:44 ` Jakub Narebski
2006-09-17  7:51   ` Martin Waitz
2006-09-17  8:23     ` Jakub Narebski
2006-09-19  8:29       ` Martin Waitz
2006-09-19 11:57         ` [PATCH] gitweb: Fix mimetype_guess_file for files with multiple extensions Jakub Narebski
2006-09-17  8:41     ` [PATCH] gitweb: use correct mime type even if filename has multiple dots Junio C Hamano
2006-09-17  8:56       ` Jakub Narebski [this message]
2006-09-17  9:07         ` Junio C Hamano
2006-09-19  9:23       ` Martin Waitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='eej2i1$97c$1@sea.gmane.org' \
    --to=jnareb@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).