mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-09 12:35:48 +01:00
- conf.parse_apisrv_url: strip trailing slashes from the path
Since commit ca2f1a90c81cfae7d6075e882fd281ca38ffe385 a section like [https://api.opensuse.org/] was not associated with an "apiurl=https://api.opensuse.org" entry anymore.
This commit is contained in:
parent
6a7314f25d
commit
c902d174d8
@ -382,13 +382,14 @@ cookiejar = None
|
|||||||
|
|
||||||
def parse_apisrv_url(scheme, apisrv):
|
def parse_apisrv_url(scheme, apisrv):
|
||||||
if apisrv.startswith('http://') or apisrv.startswith('https://'):
|
if apisrv.startswith('http://') or apisrv.startswith('https://'):
|
||||||
return urlsplit(apisrv)[0:3]
|
url = apisrv
|
||||||
elif scheme != None:
|
elif scheme != None:
|
||||||
# the split/join is needed to get a proper url (e.g. without a trailing slash)
|
url = scheme + apisrv
|
||||||
return urlsplit(urljoin(scheme, apisrv))[0:3]
|
|
||||||
else:
|
else:
|
||||||
msg = 'invalid apiurl \'%s\' (specify the protocol (http:// or https://))' % apisrv
|
msg = 'invalid apiurl \'%s\' (specify the protocol (http:// or https://))' % apisrv
|
||||||
raise URLError(msg)
|
raise URLError(msg)
|
||||||
|
scheme, url, path = urlsplit(url)[0:3]
|
||||||
|
return scheme, url, path.rstrip('/')
|
||||||
|
|
||||||
|
|
||||||
def urljoin(scheme, apisrv, path=''):
|
def urljoin(scheme, apisrv, path=''):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user