[PATCH] ui-snapshot: Remove charset from content-type header

Martin Ashby martin at ashbysoft.com
Mon Aug 28 07:39:14 UTC 2023


The charset is only applicable for text type media types, which
snapshots are not. Including the charset in non-text media types also
breaks some client software.

Signed-off-by: Martin Ashby <martin at ashbysoft.com>
---
 ui-snapshot.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ui-snapshot.c b/ui-snapshot.c
index 18361a6..9eb1ed7 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -169,6 +169,8 @@ static int make_snapshot(const struct cgit_snapshot_format *format,
 	ctx.page.etag = oid_to_hex(&oid);
 	ctx.page.mimetype = xstrdup(format->mimetype);
 	ctx.page.filename = xstrdup(filename);
+	// A charset parameter isn't applicable for binary downloads
+	ctx.page.charset = NULL;
 	cgit_print_http_headers();
 	init_archivers();
 	format->write_func(hex, prefix);
-- 
2.41.0



More information about the CGit mailing list