mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-10-30 14:17:40 +00:00
safer
This commit is contained in:
@@ -99,7 +99,7 @@ def is_safe_valid_url(test_url):
|
|||||||
# If hosts that only contain alphanumerics are allowed ("localhost" for example)
|
# If hosts that only contain alphanumerics are allowed ("localhost" for example)
|
||||||
allow_simplehost = not strtobool(os.getenv('BLOCK_SIMPLEHOSTS', 'False'))
|
allow_simplehost = not strtobool(os.getenv('BLOCK_SIMPLEHOSTS', 'False'))
|
||||||
try:
|
try:
|
||||||
if not test_url.lower().startswith('file:') and not validators.url(test_url, simple_host=allow_simplehost):
|
if not test_url.strip().lower().startswith('file:') and not validators.url(test_url, simple_host=allow_simplehost):
|
||||||
logger.warning(f'URL "{test_url}" failed validation, aborting.')
|
logger.warning(f'URL "{test_url}" failed validation, aborting.')
|
||||||
return False
|
return False
|
||||||
except validators.ValidationError:
|
except validators.ValidationError:
|
||||||
|
|||||||
Reference in New Issue
Block a user