mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-26 12:12:11 +01:00
Make read of email adress from oscrc more robust
Fix possible KeyError when mismatch of apiurl with or without ending slash.
This commit is contained in:
parent
921b78d93c
commit
4a0df19660
@ -4288,8 +4288,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
user = conf.get_apiurl_usr(apiurl)
|
||||
|
||||
if conf.config['api_host_options'][apiurl].has_key('email'):
|
||||
os.environ['mailaddr'] = conf.config['api_host_options'][apiurl]['email']
|
||||
# work with all combinations of URL with or withouth the ending slash
|
||||
apiurl2 = apiurl[:-1] if apiurl[-1] == '/' else ("%s/" % apiurl)
|
||||
host_opts = conf.config['api_host_options'].get(apiurl) or \
|
||||
conf.config['api_host_options'].get(apiurl2)
|
||||
|
||||
if host_opts and host_opts.has_key('email'):
|
||||
os.environ['mailaddr'] = host_opts['email']
|
||||
else:
|
||||
try:
|
||||
os.environ['mailaddr'] = get_user_data(apiurl, user, 'email')[0]
|
||||
|
Loading…
x
Reference in New Issue
Block a user