From c0412bc3046a302ef813dd6e78bd555c1072aa88 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 7 Nov 2026 09:38:22 -1000 Subject: Test a content filter that exits non-zero cgit takes no notice of how an about, commit, source or email filter exits, and nothing showed that a failing one still leaves the page whole. --- tests/t0201-filters.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/t0201-filters.sh b/tests/t0201-filters.sh index 4b39f18..1f137b8 100755 --- a/tests/t0201-filters.sh +++ b/tests/t0201-filters.sh @@ -89,6 +89,18 @@ test_expect_success 'only a repository page hands filters its variables' ' grep "repo url: \." tmp ' +# Only the auth filter's exit status means anything, so a content filter that +# fails after writing its output still leaves the page whole. +test_expect_success 'a content filter that exits non-zero still renders the page' ' + write_script failing-filter <<-\EOF && + cat + exit 3 + EOF + cgitrc_repo failingrc foo "repo.commit-filter=exec:$PWD/failing-filter" && + cgit_ok failingrc "url=foo/commit/" >tmp && + test_grep "
commit 5" tmp +' + # A die inside a lua filter has to reach the visitor as an error page rather # than being fed back into the filter that just failed, and the reason goes to # the log. -- cgit 2.12.1