mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-25 16:50:14 +00:00
validate blocklist URL before adding to the database (#3237)
Signed-off-by: Adam Warner <me@adamwarner.co.uk> Co-authored-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
0fad979206
commit
7d19ee1b25
2 changed files with 33 additions and 10 deletions
|
@ -374,7 +374,14 @@ gravity_DownloadBlocklists() {
|
|||
esac
|
||||
|
||||
echo -e " ${INFO} Target: ${url}"
|
||||
gravity_DownloadBlocklistFromUrl "${url}" "${cmd_ext}" "${agent}" "${sourceIDs[$i]}" "${saveLocation}" "${target}"
|
||||
local regex
|
||||
# Check for characters NOT allowed in URLs
|
||||
regex="[^a-zA-Z0-9:/?&%=~._-]"
|
||||
if [[ "${url}" =~ ${regex} ]]; then
|
||||
echo -e " ${CROSS} Invalid Target"
|
||||
else
|
||||
gravity_DownloadBlocklistFromUrl "${url}" "${cmd_ext}" "${agent}" "${sourceIDs[$i]}" "${saveLocation}" "${target}"
|
||||
fi
|
||||
echo ""
|
||||
done
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue