try another fix for #2028

Signed-off-by: Jacob Salmela <jacob.salmela@pi-hole.net>
This commit is contained in:
Jacob Salmela 2018-03-31 16:12:29 -05:00
parent c3f391dc5a
commit 187848660c
No known key found for this signature in database
GPG Key ID: 1962FF1A5046135E
1 changed files with 1 additions and 2 deletions

View File

@ -382,9 +382,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}" | tr -d '\0')
IFS= read -r -d '' lastLine <"${piholeDir}/${matterAndLight}" || [[ $lastLine ]]
if [[ "${#lastLine}" -gt 0 ]]; then
echo "" >> "${piholeDir}/${matterAndLight}"
fi