[utils] Process bytestrings in urljoin (closes #12369)
This commit is contained in:
parent
96182695e4
commit
4b5de77bdb
2 changed files with 9 additions and 1 deletions
|
@ -1748,11 +1748,16 @@ def base_url(url):
|
|||
|
||||
|
||||
def urljoin(base, path):
|
||||
if isinstance(path, bytes):
|
||||
path = path.decode('utf-8')
|
||||
if not isinstance(path, compat_str) or not path:
|
||||
return None
|
||||
if re.match(r'^(?:https?:)?//', path):
|
||||
return path
|
||||
if not isinstance(base, compat_str) or not re.match(r'^(?:https?:)?//', base):
|
||||
if isinstance(base, bytes):
|
||||
base = base.decode('utf-8')
|
||||
if not isinstance(base, compat_str) or not re.match(
|
||||
r'^(?:https?:)?//', base):
|
||||
return None
|
||||
return compat_urlparse.urljoin(base, path)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue