1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-09-06 05:08:42 +02:00

- fixed #521895 ('osc vc crashes'): only use and store proper apiurls this means no trailing slashes etc.

This commit is contained in:
Marcus Hüwe
2009-07-16 12:07:14 +00:00
parent d2dee3c525
commit 9f8c7398b4
2 changed files with 7 additions and 3 deletions

View File

@@ -157,7 +157,8 @@ def parse_apisrv_url(scheme, apisrv):
if apisrv.startswith('http://') or apisrv.startswith('https://'):
return urlparse.urlsplit(apisrv)[0:2]
elif scheme != None:
return scheme, apisrv
# the split/join is needed to get a proper url (e.g. without a trailing slash)
return urlparse.urlsplit(urljoin(scheme, apisrv))[0:2]
else:
from urllib2 import URLError
msg = 'invalid apiurl \'%s\' (specify the protocol (http:// or https://))' % apisrv
@@ -362,6 +363,7 @@ def get_config(override_conffile = None,
raise oscerr.ConfigError(msg, conffile)
config = dict(cp.items('general', raw=1))
config['apiurl'] = urljoin(*parse_apisrv_url(None, config['apiurl']))
# backward compatibility
if config.has_key('apisrv'):