about summary refs log tree commit diff stats
path: root/ui-blame.c
diff options
context:
space:
mode:
authorJune McEnroe2019-12-18 21:30:12 +0000
committerJune McEnroe2022-02-13 11:47:27 -0500
commit8bf017ec534a5df4172a612ae0a32532df7b32ad (patch)
tree8021260ee7cd494f9997fd6aa44dba70653c3892 /ui-blame.c
parentRemove dependency on memrchr (diff)
downloadcgit-8bf017ec534a5df4172a612ae0a32532df7b32ad.tar.gz
cgit-8bf017ec534a5df4172a612ae0a32532df7b32ad.zip
Bail from blame if blob is binary
This avoids piping binary blobs through the source-filter.
Diffstat (limited to 'ui-blame.c')
-rw-r--r--ui-blame.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ui-blame.c b/ui-blame.c index f28eea0..08832cd 100644 --- a/ui-blame.c +++ b/ui-blame.c
@@ -151,6 +151,10 @@ static void print_object(const struct object_id *oid, const char *path,
151 cgit_tree_link("tree", NULL, NULL, ctx.qry.head, rev, path); 151 cgit_tree_link("tree", NULL, NULL, ctx.qry.head, rev, path);
152 html(")\n"); 152 html(")\n");
153 153
154 if (buffer_is_binary(buf, size)) {
155 html("<div class='error'>blob is binary.</div>");
156 goto cleanup;
157 }
154 if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) { 158 if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) {
155 htmlf("<div class='error'>blob size (%ldKB)" 159 htmlf("<div class='error'>blob size (%ldKB)"
156 " exceeds display size limit (%dKB).</div>", 160 " exceeds display size limit (%dKB).</div>",