Use regexp to validate urls

This commit is contained in:
Romain bignon 2014-04-18 09:55:31 +02:00 committed by Florent
commit b268fc043b

View file

@ -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