1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-03 18:16:17 +01:00

- conf.parse_apisrv_url: strip trailing slashes from the path

Since commit ca2f1a90c8 a section like
[https://api.opensuse.org/] was not associated with an
"apiurl=https://api.opensuse.org" entry anymore.
This commit is contained in:
Marcus Huewe 2015-08-20 14:45:02 +02:00
parent 6a7314f25d
commit c902d174d8

View File

@ -382,13 +382,14 @@ cookiejar = None
def parse_apisrv_url(scheme, apisrv):
if apisrv.startswith('http://') or apisrv.startswith('https://'):
return urlsplit(apisrv)[0:3]
url = apisrv
elif scheme != None:
# the split/join is needed to get a proper url (e.g. without a trailing slash)
return urlsplit(urljoin(scheme, apisrv))[0:3]
url = scheme + apisrv
else:
msg = 'invalid apiurl \'%s\' (specify the protocol (http:// or https://))' % apisrv
raise URLError(msg)
scheme, url, path = urlsplit(url)[0:3]
return scheme, url, path.rstrip('/')
def urljoin(scheme, apisrv, path=''):