diff options
Diffstat (limited to 'tests/t0110-snapshot.sh')
-rwxr-xr-xtests/t0110-snapshot.sh21
1 file changed, 21 insertions, 0 deletions
diff --git a/tests/t0110-snapshot.sh b/tests/t0110-snapshot.sh
index 4852e7b..ec0a0b8 100755
--- a/tests/t0110-snapshot.sh
+++ b/tests/t0110-snapshot.sh
@@ -146,4 +146,25 @@ test_expect_success 'a real case collision keeps the v on both tags' '
! grep "vtags-1.0.tar.gz" tmp
'
+# A name that is all suffix names no revision, and an empty snapshot-prefix
+# gives the members no leading directory rather than a leading slash.
+test_expect_success 'a snapshot name with nothing before its suffix is refused' '
+ git -C repos/vtags branch v HEAD &&
+ sed "s/^snapshots=tar.gz$/snapshots=tar/" vtagsrc >vtagstarrc &&
+ CGIT_CONFIG="$PWD/vtagstarrc" QUERY_STRING="url=vtags/snapshot/.tar" cgit >tmp &&
+ grep "^Status: 404" tmp
+'
+
+test_expect_success 'an empty snapshot-prefix puts no slash ahead of the members' '
+ {
+ cat vtagstarrc &&
+ echo "repo.snapshot-prefix="
+ } >noprefixrc &&
+ CGIT_CONFIG="$PWD/noprefixrc" QUERY_STRING="url=vtags/snapshot/vtags.tar&id=master" cgit >tmp &&
+ strip_headers <tmp >noprefix.tar &&
+ tar -tf noprefix.tar >members &&
+ grep "^file-1$" members &&
+ ! grep "^/" members
+'
+
test_done