diff options
Diffstat (limited to 'source/ui-blame.c')
| -rw-r--r-- | source/ui-blame.c | 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 13 insertions, 1 deletion
diff --git a/source/ui-blame.c b/source/ui-blame.c index 80512a0..a7010d0 100644 --- a/source/ui-blame.c +++ b/source/ui-blame.c @@ -307,7 +307,19 @@ static void print_blame_page(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)) { + // A NUL past the window buffer_is_binary sniffs would end html_txt + // early while the hash and line number columns still cover the whole + // file, so a blob holding one anywhere is treated as binary too. + if (buffer_is_binary(buf, size) || memchr(buf, 0, size)) { + struct blame_entry *ent = sb.ent, *next; + + // The scoreboard is normally consumed by the column passes, + // so this early exit has to release it itself. + for (; ent; ent = next) { + next = ent->next; + free(ent); + } + free((void *)sb.final_buf); html("<div class='error'>blob is binary.</div>"); goto cleanup; } |
