Merge pull request #1302 from pi-hole/fix/nowildcardlistfile

Check for existence of wildcard blocking list (query adlists)
This commit is contained in:
DL6ER 2017-03-06 17:03:34 +01:00 committed by GitHub
commit af17355fe7

24
pihole
View file

@ -128,17 +128,19 @@ queryFunc() {
done done
# Scan for possible wildcard matches # Scan for possible wildcard matches
local wildcards=($(processWildcards "${domain}")) if [ -e "${wildcardlist}" ]; then
for domain in ${wildcards[@]}; do local wildcards=($(processWildcards "${domain}"))
result=$(scanList "\/${domain}\/" ${wildcardlist}) for domain in ${wildcards[@]}; do
# Remove empty lines before couting number of results result=$(scanList "\/${domain}\/" ${wildcardlist})
count=$(sed '/^\s*$/d' <<< "$result" | wc -l) # Remove empty lines before couting number of results
if [[ ${count} > 0 ]]; then count=$(sed '/^\s*$/d' <<< "$result" | wc -l)
echo "::: Wildcard blocking ${domain} (${count} results)" if [[ ${count} > 0 ]]; then
echo "${result}" echo "::: Wildcard blocking ${domain} (${count} results)"
echo "" echo "${result}"
fi echo ""
done fi
done
fi
exit 0 exit 0
} }