From aece9fd96a8b5aab54476092cd79c3df69c8a541 Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Sun, 5 Feb 2017 11:54:45 -0800 Subject: [PATCH] Finally fix sc.txt.cgi --- cgi-bin/sc.txt.cgi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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}" + -- 2.47.3