about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorC. McEnroe <june@causal.agency>2019-12-18T21·30+0000
committerVincent Ambo <tazjin@google.com>2020-02-21T21·02+0000
commit37b0b37771f066775120e8f3932bd68c34d57e8a (patch)
tree93bb2c146f1ecc92d42feaa68a9f4c59d7e29a63 /third_party
parent68d1d87a9b2fbccf866230a3d2c95ae0771c82e5 (diff)
feat(cgit/ui-blame): bail if blob is binary
This avoids piping binary blobs through the source-filter.
Diffstat (limited to 'third_party')
-rw-r--r--third_party/cgit/ui-blame.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/third_party/cgit/ui-blame.c b/third_party/cgit/ui-blame.c
index 45fe191344..886c4c19fd 100644
--- a/third_party/cgit/ui-blame.c
+++ b/third_party/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>",