Handle LocationParseError from parse_url()
This commit is contained in:
parent
ab82c6b91f
commit
542952cd75
10
buku
10
buku
@ -3139,14 +3139,14 @@ def is_bad_url(url):
|
|||||||
# Get the netloc token
|
# Get the netloc token
|
||||||
try:
|
try:
|
||||||
netloc = parse_url(url).netloc
|
netloc = parse_url(url).netloc
|
||||||
|
if not netloc:
|
||||||
|
# Try of prepend '//' and get netloc
|
||||||
|
netloc = parse_url('//' + url).netloc
|
||||||
|
if not netloc:
|
||||||
|
return True
|
||||||
except LocationParseError as e:
|
except LocationParseError as e:
|
||||||
LOGERR('%s, URL: %s', e, url)
|
LOGERR('%s, URL: %s', e, url)
|
||||||
return True
|
return True
|
||||||
if not netloc:
|
|
||||||
# Try of prepend '//' and get netloc
|
|
||||||
netloc = parse_url('//' + url).netloc
|
|
||||||
if not netloc:
|
|
||||||
return True
|
|
||||||
|
|
||||||
LOGDBG('netloc: %s', netloc)
|
LOGDBG('netloc: %s', netloc)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user