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 'source/ui-tree.c')
-rw-r--r--source/ui-tree.c6
1 file changed, 3 insertions, 3 deletions
diff --git a/source/ui-tree.c b/source/ui-tree.c
index 3e2fb5e..d023502 100644
--- a/source/ui-tree.c
+++ b/source/ui-tree.c
@@ -13,6 +13,7 @@
#include "cgit.h"
#include "filter.h"
#include "html.h"
+#include "shared.h"
#include "ui-shared.h"
#include "ui-tree.h"
@@ -175,9 +176,8 @@ static bool print_object(const struct object_id *oid, const char *path,
return false;
}
- 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 false;
}