link checker: Only let http links pass if whitelisted
@@ -49,6 +49,7 @@ TRIES=5
check() {
link=$(echo "$1" | grep -oE "(https|http|ftp):[^|]*")
+ secure_link=$(echo "$1" | grep -oE "(https|ftp):[^|]*")
files=$(echo "$1" | grep -oE "\|.*" | sed 's/|/ /g')
if echo "$link" | grep -Eqf "$WHITELIST"; then
@@ -60,6 +61,10 @@ check() {
echo "check the link format of $1"
return
fi
+ if [ -z "$secure_link" ]; then
+ echo "link $1 is an http link but not whitelisted"
+ return
+ fi
wget --spider --quiet --timeout=$TIMEOUT --tries=$TRIES "$link"
if [ "$?" -ne "0" ]; then
wget -O - --quiet --timeout=$TIMEOUT --tries=$TRIES "$link" > /dev/null
