@@ -43,8 +43,14 @@ test_expect_success "path gw: backlink on root CID should be hidden" '
4343 test_should_not_contain "<a href=\"/ipfs/$DIR_CID/\">..</a>" list_response
4444'
4545
46- test_expect_success " path gw: Etag should be present " '
46+ test_expect_success " path gw: redirect dir listing to URL with trailing slash " '
4747 curl -sD - http://127.0.0.1:$GWAY_PORT/ipfs/${DIR_CID}/ą/ę > list_response &&
48+ test_should_contain "HTTP/1.1 301 Moved Permanently" list_response &&
49+ test_should_contain "Location: /ipfs/${DIR_CID}/%c4%85/%c4%99/" list_response
50+ '
51+
52+ test_expect_success " path gw: Etag should be present" '
53+ curl -sD - http://127.0.0.1:$GWAY_PORT/ipfs/${DIR_CID}/ą/ę/ > list_response &&
4854 test_should_contain "Index of" list_response &&
4955 test_should_contain "Etag: \"DirIndex-" list_response
5056'
@@ -72,31 +78,37 @@ test_expect_success "path gw: hash column should be a CID link with filename par
7278DIR_HOSTNAME=" ${DIR_CID} .ipfs.localhost"
7379# note: we skip DNS lookup by running curl with --resolve $DIR_HOSTNAME:127.0.0.1
7480
75- test_expect_success " path gw: backlink on root CID should be hidden" '
81+ test_expect_success " subdomain gw: backlink on root CID should be hidden" '
7682 curl -sD - --resolve $DIR_HOSTNAME:$GWAY_PORT:127.0.0.1 http://$DIR_HOSTNAME:$GWAY_PORT/ > list_response &&
7783 test_should_contain "Index of" list_response &&
7884 test_should_not_contain "<a href=\"/\">..</a>" list_response
7985'
8086
81- test_expect_success " path gw: Etag should be present " '
87+ test_expect_success " subdomain gw: redirect dir listing to URL with trailing slash " '
8288 curl -sD - --resolve $DIR_HOSTNAME:$GWAY_PORT:127.0.0.1 http://$DIR_HOSTNAME:$GWAY_PORT/ą/ę > list_response &&
89+ test_should_contain "HTTP/1.1 301 Moved Permanently" list_response &&
90+ test_should_contain "Location: /%c4%85/%c4%99/" list_response
91+ '
92+
93+ test_expect_success " subdomain gw: Etag should be present" '
94+ curl -sD - --resolve $DIR_HOSTNAME:$GWAY_PORT:127.0.0.1 http://$DIR_HOSTNAME:$GWAY_PORT/ą/ę/ > list_response &&
8395 test_should_contain "Index of" list_response &&
8496 test_should_contain "Etag: \"DirIndex-" list_response
8597'
8698
87- test_expect_success " path gw: backlink on subdirectory should point at parent directory" '
99+ test_expect_success " subdomain gw: backlink on subdirectory should point at parent directory" '
88100 test_should_contain "<a href=\"/%C4%85/%C4%99/..\">..</a>" list_response
89101'
90102
91103test_expect_success " subdomain gw: breadcrumbs should leverage path-based router mounted on the parent domain" '
92104 test_should_contain "/ipfs/<a href=\"//localhost:$GWAY_PORT/ipfs/$DIR_CID\">$DIR_CID</a>/<a href=\"//localhost:$GWAY_PORT/ipfs/$DIR_CID/%C4%85\">ą</a>/<a href=\"//localhost:$GWAY_PORT/ipfs/$DIR_CID/%C4%85/%C4%99\">ę</a>" list_response
93105'
94106
95- test_expect_success " path gw: name column should be a link to content root mounted at subdomain origin" '
107+ test_expect_success " subdomain gw: name column should be a link to content root mounted at subdomain origin" '
96108 test_should_contain "<a href=\"/%C4%85/%C4%99/file-%C5%BA%C5%82.txt\">file-źł.txt</a>" list_response
97109'
98110
99- test_expect_success " path gw: hash column should be a CID link to path router with filename param" '
111+ test_expect_success " subdomain gw: hash column should be a CID link to path router with filename param" '
100112 test_should_contain "<a class=\"ipfs-hash\" translate=\"no\" href=\"//localhost:$GWAY_PORT/ipfs/$FILE_CID?filename=file-%25C5%25BA%25C5%2582.txt\">" list_response
101113'
102114
@@ -121,8 +133,14 @@ test_expect_success "dnslink gw: backlink on root CID should be hidden" '
121133 test_should_not_contain "<a href=\"/\">..</a>" list_response
122134'
123135
124- test_expect_success " dnslink gw: Etag should be present " '
136+ test_expect_success " dnslink gw: redirect dir listing to URL with trailing slash " '
125137 curl -sD - --resolve $DNSLINK_HOSTNAME:$GWAY_PORT:127.0.0.1 http://$DNSLINK_HOSTNAME:$GWAY_PORT/ą/ę > list_response &&
138+ test_should_contain "HTTP/1.1 301 Moved Permanently" list_response &&
139+ test_should_contain "Location: /%c4%85/%c4%99/" list_response
140+ '
141+
142+ test_expect_success " dnslink gw: Etag should be present" '
143+ curl -sD - --resolve $DNSLINK_HOSTNAME:$GWAY_PORT:127.0.0.1 http://$DNSLINK_HOSTNAME:$GWAY_PORT/ą/ę/ > list_response &&
126144 test_should_contain "Index of" list_response &&
127145 test_should_contain "Etag: \"DirIndex-" list_response
128146'
0 commit comments