mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-26 22:56:15 +01:00
- fixed #521895 ('osc vc crashes'): only use and store proper apiurls this means no trailing slashes etc.
This commit is contained in:
parent
d2dee3c525
commit
9f8c7398b4
@ -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'):
|
||||
|
@ -3283,10 +3283,12 @@ def store_read_package(dir):
|
||||
def store_read_apiurl(dir):
|
||||
fname = os.path.join(dir, store, '_apiurl')
|
||||
try:
|
||||
apiurl = open(fname).readlines()[0].strip()
|
||||
url = open(fname).readlines()[0].strip()
|
||||
# this is needed to get a proper apiurl
|
||||
# (former osc versions may stored an apiurl with a trailing slash etc.)
|
||||
apiurl = conf.urljoin(*conf.parse_apisrv_url(None, url))
|
||||
except:
|
||||
apiurl = conf.config['apiurl']
|
||||
#store_write_apiurl(dir, apiurl)
|
||||
return apiurl
|
||||
|
||||
def store_write_string(dir, file, string):
|
||||
|
Loading…
Reference in New Issue
Block a user