diff options
author | June McEnroe <june@causal.agency> | 2019-12-18 21:30:12 +0000 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2022-12-19 15:14:05 +0100 |
commit | cc6d9cc7fc010db9be6c2d90fd054fb2d189d629 (patch) | |
tree | 667023ef4d1976928d7055e441efc3afc789e375 /ui-blame.c | |
parent | e10159691e799d0f31f5314c73f47511cc974f46 (diff) | |
download | cgit-cc6d9cc7fc010db9be6c2d90fd054fb2d189d629.tar.gz cgit-cc6d9cc7fc010db9be6c2d90fd054fb2d189d629.tar.bz2 cgit-cc6d9cc7fc010db9be6c2d90fd054fb2d189d629.zip |
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 <Jason@zx2c4.com>
Diffstat (limited to 'ui-blame.c')
-rw-r--r-- | ui-blame.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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("<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>", |