mirror of
https://github.com/pi-hole/PADD.git
synced 2026-04-02 00:18:44 +01:00
Convert values to strings before using join function for jq 1.5 support (#491)
This commit is contained in:
3
padd.sh
3
padd.sh
@@ -353,7 +353,8 @@ GetPADDData() {
|
||||
# Using "paths(scalars | true)" will return null and false values.
|
||||
# We also check if the value is exactly `null` and, in this case, return the
|
||||
# string "null", as jq would return an empty string for nulls.
|
||||
padd_data=$(echo "${response}" | jq -r 'paths(scalars | true) as $p | [$p | join(".")] + [if getpath($p)!=null then getpath($p) else "null" end] | join("=")' 2>/dev/null)
|
||||
# 'tostring' is necessary because jq < 1.6 does not convert numbers and bools automatically
|
||||
padd_data=$(echo "${response}" | jq -r 'paths(scalars | true) as $p | [[$p | .[] | tostring] | join(".")] + [if getpath($p)!=null then (getpath($p) | tostring) else "null" end] | join("=")' 2>/dev/null)
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user