Fix prefix handling for relative urls
Basically we just remove the trailing prefix / and leading path / and then join with /.
This commit is contained in:
parent
cc79b5fd98
commit
22bef30f81
@ -63,7 +63,9 @@ def create_url(base_url, host, port=None, prefix='', ssl=False):
|
|||||||
# this covers most common cases and will be okay until someone
|
# this covers most common cases and will be okay until someone
|
||||||
# reports a bug.
|
# reports a bug.
|
||||||
if prefix and not path.startswith(prefix):
|
if prefix and not path.startswith(prefix):
|
||||||
path = '%s%s' % (prefix, path)
|
prefix = prefix.rstrip('/')
|
||||||
|
path = path.lstrip('/')
|
||||||
|
path = '%s/%s' % (prefix, path)
|
||||||
|
|
||||||
return urlparse.urlunsplit((scheme, netloc, path, query_string, ''))
|
return urlparse.urlunsplit((scheme, netloc, path, query_string, ''))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user