about summary refs log tree commit diff
path: root/ccelauthor.sh
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-04-10 08:15:04 -0400
committerZach DeCook <zachdecook@librem.one>2021-04-10 08:15:04 -0400
commitc7d0ca4262db79c8bdbcbe20540f72dbf86c7a0b (patch)
tree6c741d5511ac540b516f4c955ccd40bc9f0c36d0 /ccelauthor.sh
parent7888e969d6640782a5e1f2cac6b7338c6657cb04 (diff)
downloadcgi-bin-c7d0ca4262db79c8bdbcbe20540f72dbf86c7a0b.tar.gz
ccel: redirect some errors
Diffstat (limited to 'ccelauthor.sh')
-rwxr-xr-xccelauthor.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/ccelauthor.sh b/ccelauthor.sh
index ef3eb86..a383b68 100755
--- a/ccelauthor.sh
+++ b/ccelauthor.sh
@@ -4,6 +4,12 @@ then
 	printf "10 Enter a ccel author \r\n"
 	return
 fi
-
+if (echo "$QUERY_STRING" | grep '?'>/dev/null)
+then
+    prefix="$(echo "$QUERY_STRING"|cut -d '?' -f1)"
+    # Permanent redirect. These URLs should never have been made.
+    printf "31 ccelauthor.sh?$prefix\r\n"
+    return
+fi
 printf "20 text/gemini\r\n"
-curl https://ccel.org/index/author |grep "/$QUERY_STRING/" | sed 's@ccel/@\t@g' |sed 's/"/\t/g' |cut -f3 | sed 's/^/=> ccel.sh?/g'
+curl -q https://ccel.org/index/author 2>/dev/null|grep "/$QUERY_STRING/" | sed 's@ccel/@\t@g' |sed 's/"/\t/g' |cut -f3 | sed 's/^/=> ccel.sh?/g'