File: bug95-square-brackets.test

package info (click to toggle)
nginx 1.18.0-6.1%2Bdeb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 19,344 kB
  • sloc: ansic: 250,653; perl: 7,548; sh: 1,408; ruby: 879; python: 358; makefile: 338; awk: 36; cpp: 18
file content (19 lines) | stat: -rw-r--r-- 610 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /bin/bash
cat <<---
Bug #95: FancyIndex does not encode square brackets
https://github.com/aperezdc/ngx-fancyindex/issues/95
--
use pup

# Prepare a directory with a file that contains square brackets in the name.
mkdir -p "${TESTDIR}/bug95"
touch "${TESTDIR}"/bug95/'bug[95].txt'

nginx_start
content=$(fetch /bug95/)
test -n "${content}" || fail 'Empty response'

expected_href='bug%5B95%5D.txt'
obtained_href=$(pup -p body tbody 'tr:nth-child(2)' a 'attr{href}' <<< "${content}")
test "${expected_href}" = "${obtained_href}" || \
	fail 'Expected: %s - Obtained: %s' "${expected_href}" "${obtained_href}"