summary refs log tree commit diff
path: root/www
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-12-18 21:30:12 +0000
committerJune McEnroe <june@causal.agency>2020-12-27 19:50:54 -0500
commit183c2b0e789be27752223c164837a90dfb8fadb2 (patch)
treed994d3dde6d26e95cd7f658b3903ddf63c7dee71 /www
parentRemove dependency on memrchr (diff)
downloadsrc-183c2b0e789be27752223c164837a90dfb8fadb2.tar.gz
src-183c2b0e789be27752223c164837a90dfb8fadb2.zip
Bail from blame if blob is binary
This avoids piping binary blobs through the source-filter.
Diffstat (limited to 'www')
-rw-r--r--www/git.causal.agency/cgit/ui-blame.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/www/git.causal.agency/cgit/ui-blame.c b/www/git.causal.agency/cgit/ui-blame.c
index f28eea0c..08832cd0 100644
--- a/www/git.causal.agency/cgit/ui-blame.c
+++ b/www/git.causal.agency/cgit/ui-blame.c
@@ -151,6 +151,10 @@ static void print_object(const struct object_id *oid, const char *path,
 	cgit_tree_link("tree", NULL, NULL, ctx.qry.head, rev, path);
 	html(")\n");
 
+	if (buffer_is_binary(buf, size)) {
+		html("<div class='error'>blob is binary.</div>");
+		goto cleanup;
+	}
 	if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) {
 		htmlf("<div class='error'>blob size (%ldKB)"
 		      " exceeds display size limit (%dKB).</div>",