]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-blame.c
ui-tree,ui-blame: bail from blame if blob is binary
[ps-cgit] / ui-blame.c
index 03136f78de3283a2d0632acf3847071624fe363b..4adec2b99e5f19af19109f92677def0e635e5e9a 100644 (file)
@@ -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>",