1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 14:58:08 +00:00

Apply suggestions from code review

Co-authored-by: Adam Warner <me@adamwarner.co.uk>
Signed-off-by: yubiuser <ckoenig@posteo.de>
This commit is contained in:
yubiuser 2024-09-06 21:20:36 +02:00 committed by GitHub
parent e291a9f7e0
commit 0ad2a79624
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -699,7 +699,6 @@ gravity_ParseFileIntoDomains() {
# 3) Remove lines starting with ! (ABP Comments) # 3) Remove lines starting with ! (ABP Comments)
# 4) Remove lines starting with [ (ABP Header) # 4) Remove lines starting with [ (ABP Header)
# 5) Remove lines containing ABP extended CSS selectors ("##", "#!#", "#@#", "#?#") preceded by a letter # 5) Remove lines containing ABP extended CSS selectors ("##", "#!#", "#@#", "#?#") preceded by a letter
# 6) Remove lines containing Adguard JavaScript rules ("#%#") preceded by a letter
# 7) Remove comments (text starting with "#", include possible spaces before the hash sign) # 7) Remove comments (text starting with "#", include possible spaces before the hash sign)
# 8) Remove leading tabs, spaces, etc. (Also removes leading IP addresses) # 8) Remove leading tabs, spaces, etc. (Also removes leading IP addresses)
# 9) Remove empty lines # 9) Remove empty lines
@ -708,8 +707,7 @@ gravity_ParseFileIntoDomains() {
-e 's/\r$//' \ -e 's/\r$//' \
-e 's/\s*!.*//g' \ -e 's/\s*!.*//g' \
-e 's/\s*\[.*//g' \ -e 's/\s*\[.*//g' \
-e '/[a-z]\#[$?@]{0,1}\#/d' \ -e '/[a-z]\#[$?@%]{0,3}\#/d' \
-e '/[a-z]\#%\#/d' \
-e 's/\s*#.*//g' \ -e 's/\s*#.*//g' \
-e 's/^.*\s+//g' \ -e 's/^.*\s+//g' \
-e '/^$/d' "${destination}" -e '/^$/d' "${destination}"