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
|
base = self.browser.BASEURL
|
||||||
|
|
||||||
for regex in self.urls:
|
for regex in self.urls:
|
||||||
if regex.startswith('/'):
|
if not re.match(r'^\w+://.*', regex):
|
||||||
regex = re.escape(base) + regex
|
regex = re.escape(base).rstrip('/') + '/' + regex.lstrip('/')
|
||||||
m = re.match(regex, url)
|
m = re.match(regex, url)
|
||||||
if m:
|
if m:
|
||||||
return m
|
return m
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue