Use ',' as the separator char in query rather than the default '|' as we now expect some valid results to contain '|'

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Signed-off-by: ipitio <21136719+ipitio@users.noreply.github.com>
pull/5218/head
Adam Warner 1 year ago committed by ipitio
parent 7f55bde6d8
commit 9a6c09fc97

@ -119,7 +119,7 @@ scanDatabaseTable() {
fi
# Send prepared query to gravity database
result="$(pihole-FTL sqlite3 "${gravityDBfile}" "${querystr}")" 2> /dev/null
result="$(pihole-FTL sqlite3 -separator ',' "${gravityDBfile}" "${querystr}")" 2> /dev/null
if [[ -z "${result}" ]]; then
# Return early when there are no matches in this table
return
@ -139,8 +139,8 @@ scanDatabaseTable() {
# Loop over results and print them
mapfile -t results <<< "${result}"
for result in "${results[@]}"; do
domain="${result/|*}"
if [[ "${result#*|}" == "0" ]]; then
domain="${result/,*}"
if [[ "${result#*,}" == "0" ]]; then
extra=" (disabled)"
else
extra=""
@ -215,10 +215,10 @@ if [[ -n "${exact}" ]]; then
fi
for result in "${results[@]}"; do
match="${result/|*/}"
extra="${result#*|}"
adlistAddress="${extra/|*/}"
extra="${extra#*|}"
match="${result/,*/}"
extra="${result#*,}"
adlistAddress="${extra/,*/}"
extra="${extra#*,}"
if [[ "${extra}" == "0" ]]; then
extra=" (disabled)"
else

Loading…
Cancel
Save