From: june at causal.agency (C. McEnroe)
Subject: [PATCH 1/2] ui-blame: bail if blob is binary
Date: Wed, 18 Dec 2019 16:52:30 -0500 [thread overview]
Message-ID: <20191218215231.10961-1-june@causal.agency> (raw)
This avoids piping binary blobs through the source-filter.
---
ui-blame.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/ui-blame.c b/ui-blame.c
index 644c30a..ecbe325 100644
--- a/ui-blame.c
+++ b/ui-blame.c
@@ -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>",
--
2.23.0
next reply other threads:[~2019-12-18 21:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-18 21:52 june [this message]
2019-12-18 21:52 ` [PATCH 2/2] ui-tree: don't link to blame for binary blobs june
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191218215231.10961-1-june@causal.agency \
--to=cgit@lists.zx2c4.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).