Fixed an issue on Linux systems where the /upgrade_check API in server mode raised a KeyError.
parent
f8b894d52b
commit
c1eb8cb24e
|
|
@ -394,22 +394,28 @@ def upgrade_check():
|
||||||
'Exception when checking for update')
|
'Exception when checking for update')
|
||||||
return internal_server_error('Failed to check for update')
|
return internal_server_error('Failed to check for update')
|
||||||
|
|
||||||
if data:
|
if data and config.UPGRADE_CHECK_KEY and \
|
||||||
|
config.UPGRADE_CHECK_KEY in data:
|
||||||
# Determine platform
|
# Determine platform
|
||||||
if sys.platform == 'darwin':
|
if sys.platform.startswith("darwin"):
|
||||||
platform = 'macos'
|
platform = 'macos'
|
||||||
elif sys.platform == 'win32':
|
elif sys.platform.startswith("win"):
|
||||||
platform = 'windows'
|
platform = 'windows'
|
||||||
|
elif sys.platform.startswith("linux"):
|
||||||
|
platform = 'linux'
|
||||||
|
|
||||||
upgrade_version_int = data[config.UPGRADE_CHECK_KEY]['version_int']
|
upgrade_version_int = data[config.UPGRADE_CHECK_KEY]['version_int']
|
||||||
auto_update_url_exists = data[config.UPGRADE_CHECK_KEY][
|
auto_update_url_dict = (data[config.UPGRADE_CHECK_KEY]
|
||||||
'auto_update_url'][platform] != ''
|
.get('auto_update_url', {}))
|
||||||
|
auto_update_url_exists = (
|
||||||
|
platform in auto_update_url_dict and
|
||||||
|
auto_update_url_dict[platform] != ''
|
||||||
|
)
|
||||||
|
|
||||||
# Construct common response dicts for auto-update support
|
# Construct common response dicts for auto-update support
|
||||||
auto_update_common_res = {
|
auto_update_common_res = {
|
||||||
"check_for_auto_updates": True,
|
"check_for_auto_updates": True,
|
||||||
"auto_update_url": data[config.UPGRADE_CHECK_KEY][
|
"auto_update_url": auto_update_url_dict.get(platform, ''),
|
||||||
'auto_update_url'][platform],
|
|
||||||
"platform": platform,
|
"platform": platform,
|
||||||
"installer_type": config.UPGRADE_CHECK_KEY,
|
"installer_type": config.UPGRADE_CHECK_KEY,
|
||||||
"current_version": config.APP_VERSION,
|
"current_version": config.APP_VERSION,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue