From aba5e884ebe2caaade5d923b7b1ad0e4542e0433 Mon Sep 17 00:00:00 2001 From: jpgpi250 Date: Wed, 20 Apr 2022 10:19:44 +0200 Subject: [PATCH 1/4] Update gravity.sh Signed-off-by: jpgpi250 --- gravity.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 9c11fa98..e347d334 100755 --- a/gravity.sh +++ b/gravity.sh @@ -528,7 +528,9 @@ parseList() { # 1. Remove all domains containing invalid characters. Valid are: a-z, A-Z, 0-9, dot (.), minus (-), underscore (_) # 2. Append ,adlistID to every line # 3. Ensures there is a newline on the last line - sed -e "/[^a-zA-Z0-9.\_-]/d;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" + # sed -e "/[^a-zA-Z0-9.\_-]/d;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" + # previous line modified 20/04/2022, see https://github.com/pi-hole/pi-hole/issues/4701 + sed -e "/[^a-zA-Z0-9.\_-]/d;s/\.$//;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" # Find (up to) five domains containing invalid characters (see above) incorrect_lines="$(sed -e "/[^a-zA-Z0-9.\_-]/!d" "${src}" | head -n 5)" From 1c28da7bbd0a3da34787133a68fcf835847facb5 Mon Sep 17 00:00:00 2001 From: Peter Russell Date: Wed, 20 Apr 2022 10:43:39 +0200 Subject: [PATCH 2/4] Update gravity.sh Co-authored-by: yubiuser --- gravity.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index e347d334..5c1d2bc1 100755 --- a/gravity.sh +++ b/gravity.sh @@ -527,7 +527,8 @@ parseList() { # This sed does the following things: # 1. Remove all domains containing invalid characters. Valid are: a-z, A-Z, 0-9, dot (.), minus (-), underscore (_) # 2. Append ,adlistID to every line - # 3. Ensures there is a newline on the last line + # 3. Remove trailing period (see https://github.com/pi-hole/pi-hole/issues/4701) + # 4. Ensures there is a newline on the last line # sed -e "/[^a-zA-Z0-9.\_-]/d;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" # previous line modified 20/04/2022, see https://github.com/pi-hole/pi-hole/issues/4701 sed -e "/[^a-zA-Z0-9.\_-]/d;s/\.$//;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" From 325f20d5c28ccb1ff4396b88b14b6a65b7dc7078 Mon Sep 17 00:00:00 2001 From: Peter Russell Date: Wed, 20 Apr 2022 10:43:56 +0200 Subject: [PATCH 3/4] Update gravity.sh Co-authored-by: yubiuser --- gravity.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index 5c1d2bc1..d4880c24 100755 --- a/gravity.sh +++ b/gravity.sh @@ -529,7 +529,6 @@ parseList() { # 2. Append ,adlistID to every line # 3. Remove trailing period (see https://github.com/pi-hole/pi-hole/issues/4701) # 4. Ensures there is a newline on the last line - # sed -e "/[^a-zA-Z0-9.\_-]/d;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" # previous line modified 20/04/2022, see https://github.com/pi-hole/pi-hole/issues/4701 sed -e "/[^a-zA-Z0-9.\_-]/d;s/\.$//;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" # Find (up to) five domains containing invalid characters (see above) From 052a1f294e73e0307b440ef3862a9e3e3f92d767 Mon Sep 17 00:00:00 2001 From: Peter Russell Date: Wed, 20 Apr 2022 10:44:05 +0200 Subject: [PATCH 4/4] Update gravity.sh Co-authored-by: yubiuser --- gravity.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/gravity.sh b/gravity.sh index d4880c24..c5e9e414 100755 --- a/gravity.sh +++ b/gravity.sh @@ -529,7 +529,6 @@ parseList() { # 2. Append ,adlistID to every line # 3. Remove trailing period (see https://github.com/pi-hole/pi-hole/issues/4701) # 4. Ensures there is a newline on the last line - # previous line modified 20/04/2022, see https://github.com/pi-hole/pi-hole/issues/4701 sed -e "/[^a-zA-Z0-9.\_-]/d;s/\.$//;s/$/,${adlistID}/;/.$/a\\" "${src}" >> "${target}" # Find (up to) five domains containing invalid characters (see above) incorrect_lines="$(sed -e "/[^a-zA-Z0-9.\_-]/!d" "${src}" | head -n 5)"