Re: [PATCH] gitweb: safely output binary files for 'blob_plain' action
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jun 17, 2006, 21:13 UTC
- Message-ID
- <7v8xnv8ozp.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <20060617153540.GI2609@pasky.or.cz>
Petr Baudis <pasky@suse.cz> writes:
Show 9 quoted lines
> Dear diary, on Sat, Jun 17, 2006 at 01:32:15PM CEST, I got a letter > where Jakub Narebski <jnareb@gmail.com> said that... >> Introduced new configuration variables: $default_blob_plain_mimetype >> and $default_text_plain_charset (only 'utf-8' is guaranteed to work >> for the latter). > > Nah, defaulting to 'utf-8' is horrible - usually, you just don't have a > clue and should refrain from sending any charset information at all, so > I think undef is a much saner default.
Concurred. I see Jakub's second patch to make this configurable, but I wonder about a few things:
- we might want to have a configuration mechanism in place before enhancing gitweb. My gut feeling is that we can use [gitweb] section in project.git/config (and probably duplicate first and deprecate later existing "description" as well).
- the blob charset should be per path -- otherwise the feature would be not useful for projects that maintains bunch of po files.
In other words, something like this:
(in torvalds/linux-2.6.git/config)
[gitweb]
description = "Linus's kernel tree"
; defaultblobcharset = "latin1"
blobmimemapfile = "mime-map"(in torvalds/linux-2.6.git/mime-map, first match decides)
fs/nls/nls_euc-jp.c text/plain; charset=euc_jp
*.c text/plain; charset=utf-8
*.h text/plain; charset=utf-8I do not think defaultblobcharset above is a good idea though. You could just have the last entry in mime-map file to be:
* text/plain; charset=latin1