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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]