diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Keep the query string across the about redirects
The hop to the trailing-slash form of the about page, and the hop back to the summary of a repository without a readme, were built from the path alone, so a request for the about page of another branch landed on the default one. The query goes into the Location line as the client sent it, with any byte a header cannot carry percent-encoded.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t0303-robustness.sh13
1 file changed, 13 insertions, 0 deletions
diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh
index be98644..73c2ca5 100755
--- a/tests/t0303-robustness.sh
+++ b/tests/t0303-robustness.sh
@@ -507,6 +507,19 @@ test_expect_success 'the dumb transport withholds the alternates file' '
grep "^Status: 200" tmp
'
+# The about page redirects to its trailing-slash form so relative links
+# resolve, and the branch asked for has to survive that hop, as does the
+# hop back to the summary of a repository without a readme.
+test_expect_success 'the about redirects keep the query string' '
+ git -C repos/rob branch other HEAD &&
+ CGIT_CONFIG="$PWD/aboutrc" QUERY_STRING="url=rob/about&h=other&x=1" cgit >tmp &&
+ grep "^Status: 301" tmp &&
+ grep "^Location: /rob/about/?h=other&x=1$" tmp &&
+ robq "url=rob/about/&h=other" >tmp &&
+ grep "^Status: 302" tmp &&
+ grep "^Location: /rob/about/../?h=other$" tmp
+'
+
test_expect_success 'a symlink whose target is a large blob is listed without it' '
big=$(head -c 5000 /dev/zero | tr "\0" a | git -C repos/rob hash-object -w --stdin) &&
(