@@ -394,22 +394,28 @@ def upgrade_check():
394394 'Exception when checking for update' )
395395 return internal_server_error ('Failed to check for update' )
396396
397- if data :
397+ if data and config .UPGRADE_CHECK_KEY and \
398+ config .UPGRADE_CHECK_KEY in data :
398399 # Determine platform
399- if sys .platform == ' darwin' :
400+ if sys .platform . startswith ( " darwin" ) :
400401 platform = 'macos'
401- elif sys .platform == 'win32' :
402+ elif sys .platform . startswith ( "win" ) :
402403 platform = 'windows'
404+ elif sys .platform .startswith ("linux" ):
405+ platform = 'linux'
403406
404407 upgrade_version_int = data [config .UPGRADE_CHECK_KEY ]['version_int' ]
405- auto_update_url_exists = data [config .UPGRADE_CHECK_KEY ][
406- 'auto_update_url' ][platform ] != ''
408+ auto_update_url_dict = (data [config .UPGRADE_CHECK_KEY ]
409+ .get ('auto_update_url' , {}))
410+ auto_update_url_exists = (
411+ platform in auto_update_url_dict and
412+ auto_update_url_dict [platform ] != ''
413+ )
407414
408415 # Construct common response dicts for auto-update support
409416 auto_update_common_res = {
410417 "check_for_auto_updates" : True ,
411- "auto_update_url" : data [config .UPGRADE_CHECK_KEY ][
412- 'auto_update_url' ][platform ],
418+ "auto_update_url" : auto_update_url_dict .get (platform , '' ),
413419 "platform" : platform ,
414420 "installer_type" : config .UPGRADE_CHECK_KEY ,
415421 "current_version" : config .APP_VERSION ,
0 commit comments