Move urlparsing statement in add_http_if_no_scheme()

This commit is contained in:
Paul Tremberth 2016-01-25 13:13:35 +01:00
parent 5f09da60c1
commit fb8ab2427b
1 changed files with 1 additions and 1 deletions

View File

@ -116,8 +116,8 @@ def escape_ajax(url):
def add_http_if_no_scheme(url):
"""Add http as the default scheme if it is missing from the url."""
match = re.match(r"^\w+://", url, flags=re.I)
parts = urlparse(url)
if not match:
parts = urlparse(url)
scheme = "http:" if parts.netloc else "http://"
url = scheme + url