mirror of
https://git.zx2c4.com/cgit
synced 2025-07-10 10:14:34 +02:00
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>
This commit is contained in:
parent
e10159691e
commit
cc6d9cc7fc
3 changed files with 9 additions and 2 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>",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue