From f7120603edc6f2680ad01fdbe7b3dc7ddf1494ef Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 27 Sep 2026 21:02:41 -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-shared.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/ui-shared.c') diff --git a/source/ui-shared.c b/source/ui-shared.c index b793f74..fd9cd20 100644 --- a/source/ui-shared.c +++ b/source/ui-shared.c @@ -1625,6 +1625,12 @@ void cgit_vprint_error_page(int code, const char *msg, const char *fmt, va_list cgit_print_layout_end(); } +void cgit_print_blob_too_large(unsigned long 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); +} + void cgit_print_layout_start(void) { cgit_print_http_headers(); -- cgit 2.12.1