From e112b278469c1104eef3059f188ee3bd433582c8 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 12:53:14 -1000 Subject: Encode repository urls and the feed branch Links built from the repository url, among them the description link on the index and the Atom and refs links, wrote it as configured, so a name holding a space, '#' or '?' broke them. The feed link in the page head did the same with the branch, which turned a '+' into a space. --- tests/t0101-index.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'tests/t0101-index.sh') diff --git a/tests/t0101-index.sh b/tests/t0101-index.sh index b2ec813..adad6be 100755 --- a/tests/t0101-index.sh +++ b/tests/t0101-index.sh @@ -16,8 +16,8 @@ test_expect_success 'find foo description' 'grep "\[no description\]" tmp' test_expect_success 'find bar repo' 'grep "bar" tmp' test_expect_success 'find bar description' 'grep "the bar repo" tmp' test_expect_success 'find foo+bar repo' 'grep ">foo+bar<" tmp' -test_expect_success 'verify foo+bar link' 'grep "/foo+bar/" tmp' -test_expect_success 'verify "with%20space" link' 'grep "/with%20space/" tmp' +test_expect_success 'verify foo+bar links' 'test $(grep -o "href=./foo%2Bbar/." tmp | wc -l) = 2' +test_expect_success 'verify "with%20space" links' 'test $(grep -o "href=./with%20space/." tmp | wc -l) = 2' test_expect_success 'no tree-link' '! grep "foo/tree" tmp' test_expect_success 'no log-link' '! grep "foo/log" tmp' @@ -47,4 +47,10 @@ test_expect_success 'each css and js entry gets a link of its own' ' grep "/b.js" scripts ' +test_expect_success 'the feed link encodes the repository and the branch' ' + sed "s/^cache-size=.*/cache-size=0/" cgitrc >feedrc && + CGIT_CONFIG="$PWD/feedrc" HTTP_HOST=example.org QUERY_STRING="url=foo%2Bbar/log/&h=1%2B2" cgit >tmp && + grep "title=.Atom feed. href=.http://example.org/foo%2Bbar/atom/?h=1%2B2." tmp +' + test_done -- cgit