From 33a1b58333a2196dfae52dbc0c0afa151ac2683f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 1 Oct 2026 19:13:02 -1000 Subject: Send a charset only with a text type Archives, packs and the HEAD file went out as octet-stream or gzip with a UTF-8 charset on the end, since only the blob page cleared it. The headers now decide from the type itself, so the two places that cleared the charset by hand no longer need to. --- source/ui-plain.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'source/ui-plain.c') diff --git a/source/ui-plain.c b/source/ui-plain.c index 7db6e07..6d02051 100644 --- a/source/ui-plain.c +++ b/source/ui-plain.c @@ -81,14 +81,8 @@ static void print_object(const struct object_id *oid, const char *path) ctx.page.mimetype = NULL; } - if (!ctx.page.mimetype) { - if (buffer_is_binary(buf, size)) { - ctx.page.mimetype = "application/octet-stream"; - ctx.page.charset = NULL; - } else { - ctx.page.mimetype = "text/plain"; - } - } + if (!ctx.page.mimetype) + ctx.page.mimetype = buffer_is_binary(buf, size) ? "application/octet-stream" : "text/plain"; ctx.page.filename = path; ctx.page.size = size; cgit_print_http_headers(); -- cgit v2.8.0