summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui-plain.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ui-plain.c b/ui-plain.c
index 9c86542..c9ec403 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -83,17 +83,22 @@ static int print_object(const unsigned char *sha1, const char *path)
mime = string_list_lookup(&ctx.cfg.mimetypes, ext);
if (mime) {
ctx.page.mimetype = (char *)mime->util;
+ ctx.page.charset = NULL;
} else {
ctx.page.mimetype = get_mimetype_from_file(ctx.cfg.mimetype_file, ext);
- if (ctx.page.mimetype)
+ if (ctx.page.mimetype) {
freemime = 1;
+ ctx.page.charset = NULL;
+ }
}
}
if (!ctx.page.mimetype) {
- if (buffer_is_binary(buf, size))
+ if (buffer_is_binary(buf, size)) {
ctx.page.mimetype = "application/octet-stream";
- else
+ ctx.page.charset = NULL;
+ } else {
ctx.page.mimetype = "text/plain";
+ }
}
ctx.page.filename = path;
ctx.page.size = size;