diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Say why an oversized readme leaves about empty
A readme past max-blob-size is never read, which left the about page
with an empty block and no word of why.
Diffstat (limited to 'source/ui-summary.c')
| -rw-r--r-- | source/ui-summary.c | 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 8 insertions, 2 deletions
diff --git a/source/ui-summary.c b/source/ui-summary.c index 44abc6b..005263a 100644 --- a/source/ui-summary.c +++ b/source/ui-summary.c @@ -71,6 +71,7 @@ void cgit_print_summary(void) void cgit_print_repo_readme(void) { char *filename, *ref; + int err = 0; cgit_print_layout_start(); filename = ctx.repo->readme.items[0].string; @@ -82,7 +83,7 @@ void cgit_print_repo_readme(void) // into safe HTML, so it is escaped rather than served raw. html("<pre class='plaintext'>"); if (ref) { - cgit_print_file(filename, ref, 1, 1); + err = cgit_print_file(filename, ref, 1, 1); } else { struct strbuf sb = STRBUF_INIT; if (strbuf_read_file(&sb, filename, 0) >= 0) @@ -101,7 +102,7 @@ void cgit_print_repo_readme(void) // through unescaped. cgit_open_filter(ctx.repo->about_filter, filename, tree_base.buf, tree_query.buf); if (ref) - cgit_print_file(filename, ref, 1, 0); + err = cgit_print_file(filename, ref, 1, 0); else html_include(filename); cgit_close_filter(ctx.repo->about_filter); @@ -109,5 +110,10 @@ void cgit_print_repo_readme(void) strbuf_release(&tree_query); } html("</div>"); + // A readme past max-blob-size is never read, which would otherwise + // leave the about page with nothing on it. + if (err == -2) + cgit_print_error_page(413, "Content Too Large", "The readme is larger than max-blob-size (%d KB)", + ctx.cfg.max_blob_size); cgit_print_layout_end(); } |
