Use regexp to validate urls
This commit is contained in:
parent
ea574adcdb
commit
b268fc043b
1 changed files with 2 additions and 2 deletions
|
|
@ -161,8 +161,8 @@ class URL(object):
|
|||
base = self.browser.BASEURL
|
||||
|
||||
for regex in self.urls:
|
||||
if regex.startswith('/'):
|
||||
regex = re.escape(base) + regex
|
||||
if not re.match(r'^\w+://.*', regex):
|
||||
regex = re.escape(base).rstrip('/') + '/' + regex.lstrip('/')
|
||||
m = re.match(regex, url)
|
||||
if m:
|
||||
return m
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue