From 1be85369f36458fe9a2f85ca63285367f94e6172 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:26:24 -1000 Subject: 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. --- source/ui-plain.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source/ui-plain.c') 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; } -- cgit