Merge pull request #2069 from pi-hole/fix/nullbyte

Fix error: /opt/pihole/gravity.sh: 385: Warning: command substitution: ignored null byte in input
This commit is contained in:
Mark Drobnak 2018-06-20 20:42:24 -04:00 committed by GitHub
commit 4fc3546887
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -387,9 +387,8 @@ gravity_ConsolidateDownloadedBlocklists() {
if [[ -r "${i}" ]]; then
# Remove windows CRs from file, convert list to lower case, and append into $matterAndLight
tr -d '\r' < "${i}" | tr '[:upper:]' '[:lower:]' >> "${piholeDir}/${matterAndLight}"
# Ensure that the first line of a new list is on a new line
lastLine=$(tail -1 "${piholeDir}/${matterAndLight}")
IFS= read -r -d '' lastLine <"${piholeDir}/${matterAndLight}" || [[ $lastLine ]]
if [[ "${#lastLine}" -gt 0 ]]; then
echo "" >> "${piholeDir}/${matterAndLight}"
fi