feat(cgit/ui-blame): bail if blob is binary
This avoids piping binary blobs through the source-filter.
This commit is contained in:
parent
68d1d87a9b
commit
37b0b37771
1 changed files with 4 additions and 0 deletions
4
third_party/cgit/ui-blame.c
vendored
4
third_party/cgit/ui-blame.c
vendored
|
@ -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>",
|
||||
|
|
Loading…
Reference in a new issue