diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Treat text blobs with stray nuls as binary
Diffstat (limited to 'source/ui-tree.c')
| -rw-r--r-- | source/ui-tree.c | 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 4 insertions, 1 deletion
diff --git a/source/ui-tree.c b/source/ui-tree.c index 7d24d53..7df7375 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -191,7 +191,10 @@ static bool print_object(const struct object_id *oid, const char *path, "Error reading object %s", oid_to_hex(oid)); return false; } - is_binary = buffer_is_binary(buf, size); + // buffer_is_binary only sniffs the front of the blob, and a NUL past + // that window would end the escaped text render early while the line + // number column still counts the whole file, so check the rest too. + is_binary = buffer_is_binary(buf, size) || memchr(buf, 0, size); cgit_set_title_from_path(path); |
