From: Zachary Vance Date: Sun, 5 Feb 2017 19:54:45 +0000 (-0800) Subject: Finally fix sc.txt.cgi X-Git-Url: https://git.za3k.com/?a=commitdiff_plain;h=aece9fd96a8b5aab54476092cd79c3df69c8a541;p=za3k.git Finally fix sc.txt.cgi --- diff --git a/cgi-bin/sc.txt.cgi b/cgi-bin/sc.txt.cgi index 46f3832..d5e90b1 100755 --- a/cgi-bin/sc.txt.cgi +++ b/cgi-bin/sc.txt.cgi @@ -3,10 +3,19 @@ echo "Content-type: text/plain" echo QUERY_FILE="${PATH_TRANSLATED}" -[[ "${QUERY_FILE}" == *.sc.txt ]] || { echo "Invalid .sc.txt file" >/dev/stderr && exit 1 } +if [[ "${QUERY_FILE}" != *.sc.txt ]] +then + echo "Invalid .sc.txt file" >/dev/stderr + exit 1 +fi QUERY_SC_FILE="$(echo "${QUERY_FILE}" | sed -e 's/.txt$//')" -[ -f "${QUERY_SC_FILE}" ] || { echo "Invalid .sc file" >/dev/stderr && exit 1 } +if [ \! -f "${QUERY_SC_FILE}" ] +then + echo "Invalid .sc file" >/dev/stderr + exit 1 +fi -echo "Source: https://za3k.com/${QUERY_SC_FILE}" +echo "Source: $(basename ${QUERY_SC_FILE})" echo sc -W % "${QUERY_SC_FILE}" +