From 83636020a3a9ba39cc96aa03b003c99ef973ca2e Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 17:09:15 -1000 Subject: Hold patch and rawdiff to max-blob-size Both pages hand the diff to git, whose own limit on an inlined blob is 512 MB, so a commit adding a blob the other views refuse was inflated and diffed in full. The cap is passed through to git, which shows such a blob as binary. --- tests/t0204-limits.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests') diff --git a/tests/t0204-limits.sh b/tests/t0204-limits.sh index b1c797a..2d33368 100755 --- a/tests/t0204-limits.sh +++ b/tests/t0204-limits.sh @@ -214,4 +214,22 @@ test_expect_success LUA 'highlight filter passes text through without scintillua grep "int y;" tmp ' +# The patch and rawdiff pages hand the work to git, whose own limit on an +# inlined blob is far past max-blob-size, so the cap is passed through to it. +test_expect_success 'patch and rawdiff show an oversized blob as binary' ' + test_seq 1 2000 >repos/limits/big.txt && + git -C repos/limits add big.txt && + git -C repos/limits commit -q -m "big blob" && + { + echo "max-blob-size=1" && + cat limitrc + } >blobrc && + for p in patch rawdiff + do + CGIT_CONFIG="$PWD/blobrc" QUERY_STRING="url=limits/$p/" cgit >tmp && + grep "^Binary files" tmp && + ! grep "^+1999$" tmp || return 1 + done +' + test_done -- cgit