diff options
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Share the max-blob-size check and its refusal
Five copies of the test and four of the error page had to agree by hand. The new check pins the four refusals, which no test covered.
Diffstat (limited to '')
-rw-r--r--source/ui-plain.c7
1 file changed, 2 insertions, 5 deletions
diff --git a/source/ui-plain.c b/source/ui-plain.c
index 2463cfc..136e1f4 100644
--- a/source/ui-plain.c
+++ b/source/ui-plain.c
@@ -58,11 +58,8 @@ static void print_object(const struct object_id *oid, const char *path)
return;
}
- // The limit counts kilobytes and is checked before the read, so a huge
- // blob is kept out of memory rather than noticed once it is there.
- if (ctx.cfg.max_blob_size && size / 1024 > (unsigned long)ctx.cfg.max_blob_size) {
- cgit_print_error_page(413, "Content Too Large", "Blob size (%lu KB) exceeds the limit (%d KB)",
- size / 1024, ctx.cfg.max_blob_size);
+ if (cgit_blob_too_large(size)) {
+ cgit_print_blob_too_large(size);
return;
}