[PATCH v2 1/1] ui_plain: automatically lookup mimetype when mimetype-file is set
larsh at hjemli.net
larsh at hjemli.net
Tue Jul 19 11:29:47 CEST 2011
On Tue, Jul 19, 2011 at 10:51:58AM +0200, Ferry Huberts wrote:
> From: Ferry Huberts <ferry.huberts at pelagic.nl>
>
> For sites that do not want to configure mime types by hand but
> still want the correct mime type for 'plain' blobs, configuring
> a mime type file is made possible. This is handy since such a
> file is normally already provided (at least on Linux systems).
>
> Also, this reflects the gitweb option '$mimetypes_file'
>
> Signed-off-by: Ferry Huberts <ferry.huberts at pelagic.nl>
Thanks. I've merged this to my wip branch with the following fixup to
avoid random free()'s:
diff --git a/ui-plain.c b/ui-plain.c
index 50476f4..7fecc32 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -75,8 +75,8 @@ static void print_object(const unsigned char *sha1, const char *path)
}
ctx.page.mimetype = NULL;
ext = strrchr(path, '.');
+ freemime = 0;
if (ext && *(++ext)) {
- freemime = 0;
mime = string_list_lookup(&ctx.cfg.mimetypes, ext);
if (mime) {
ctx.page.mimetype = (char *)mime->util;
--
larsh
More information about the CGit
mailing list