From cc6d9cc7fc010db9be6c2d90fd054fb2d189d629 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 18 Dec 2019 21:30:12 +0000 Subject: ui-tree,ui-blame: bail from blame if blob is binary This avoids piping binary blobs through the source-filter. Also prevent robots from crawling it, since it's expensive. Signed-off-by: Jason A. Donenfeld --- ui-blame.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ui-blame.c') diff --git a/ui-blame.c b/ui-blame.c index 03136f7..4adec2b 100644 --- a/ui-blame.c +++ b/ui-blame.c @@ -152,6 +152,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("
blob is binary.
"); + goto cleanup; + } if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) { htmlf("
blob size (%ldKB)" " exceeds display size limit (%dKB).
", -- cgit v1.2.3