Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Schaper <dan.schaper@pi-hole.net>2019-09-06 07:30:34 +0300
committerGitHub <noreply@github.com>2019-09-06 07:30:34 +0300
commitb209629579886e0797048683cc979391f690e7f2 (patch)
treea1adcf54cd1c281b66b33e1f7e9210eaf6196036
parent93ecc046ea8ef0d79c1feae54fd10d5fa466e952 (diff)
parentaed2e35bc0a26c8bebbbc06e0bf70bf6140f7f3c (diff)
Merge pull request #2909 from pi-hole/fix/domains_in_comment
Print messages only after removing possible matches in comments
-rw-r--r--advanced/Scripts/query.sh28
1 files changed, 13 insertions, 15 deletions
diff --git a/advanced/Scripts/query.sh b/advanced/Scripts/query.sh
index 83bf371c..2dead97d 100644
--- a/advanced/Scripts/query.sh
+++ b/advanced/Scripts/query.sh
@@ -157,19 +157,6 @@ lists=("$(cd "$piholeDir" || exit 0; printf "%s\\n" -- *.domains | sort -V)")
# Query blocklists for occurences of domain
mapfile -t results <<< "$(scanList "${domainQuery}" "${lists[*]}" "${exact}")"
-# Handle notices
-if [[ -z "${wbMatch:-}" ]] && [[ -z "${wcMatch:-}" ]] && [[ -z "${results[*]}" ]]; then
- echo -e " ${INFO} No ${exact/t/t }results found for ${COL_BOLD}${domainQuery}${COL_NC} within the block lists"
- exit 0
-elif [[ -z "${results[*]}" ]]; then
- # Result found in WL/BL/Wildcards
- exit 0
-elif [[ -z "${all}" ]] && [[ "${#results[*]}" -ge 100 ]]; then
- echo -e " ${INFO} Over 100 ${exact/t/t }results found for ${COL_BOLD}${domainQuery}${COL_NC}
- This can be overridden using the -all option"
- exit 0
-fi
-
# Remove unwanted content from $results
# Each line in $results is formatted as such: [fileName]:[line]
# 1. Delete lines starting with #
@@ -183,8 +170,19 @@ mapfile -t results <<< "$(IFS=$'\n'; sed \
-e "s/:.*[ \\t]/:/g" \
-e "/${esc_domain}/!d" \
<<< "${results[*]}")"
-# Exit if result was in a comment
-[[ -z "${results[*]}" ]] && exit 0
+
+# Handle notices
+if [[ -z "${wbMatch:-}" ]] && [[ -z "${wcMatch:-}" ]] && [[ -z "${results[*]}" ]]; then
+ echo -e " ${INFO} No ${exact/t/t }results found for ${COL_BOLD}${domainQuery}${COL_NC} within the block lists"
+ exit 0
+elif [[ -z "${results[*]}" ]]; then
+ # Result found in WL/BL/Wildcards
+ exit 0
+elif [[ -z "${all}" ]] && [[ "${#results[*]}" -ge 100 ]]; then
+ echo -e " ${INFO} Over 100 ${exact/t/t }results found for ${COL_BOLD}${domainQuery}${COL_NC}
+ This can be overridden using the -all option"
+ exit 0
+fi
# Get adlist file content as array
if [[ -n "${adlist}" ]] || [[ -n "${blockpage}" ]]; then