From cccd9f71b89ea61de75b60a28cfa1833c2f08907 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Fri, 14 Nov 2025 08:36:39 -0500 Subject: [PATCH] verify commit before upgrade Signed-off-by: Vladimir Mandic --- installer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/installer.py b/installer.py index 83454a357..cedaaff5b 100644 --- a/installer.py +++ b/installer.py @@ -527,7 +527,8 @@ def update(folder, keep_branch = False, rebase = True, restart = False): res = git(f'checkout {commit}', folder) debug(f'Install update: folder={folder} branch={b} args={arg} commit={commit} {res}') if restart: - log.critical('Restarting application to apply updates...') + log.critical('Restarting to apply updates...') + print('HERE', sys.argv) os.execv(sys.executable, ['python'] + sys.argv) ts('update', t_start) return res @@ -1583,7 +1584,10 @@ def check_version(reset=True): # pylint: disable=unused-argument commits = None try: commits = requests.get(f'https://api.github.com/repos/vladmandic/sdnext/branches/{branch_name}', timeout=10).json() - if commits['commit']['sha'] != commit and args.upgrade: + latest = commits['commit']['sha'] + if len(latest) != 40: + log.error(f'Repository error: commit={latest} invalid') + elif latest != commit and args.upgrade: global quick_allowed # pylint: disable=global-statement quick_allowed = False log.info('Updating main repository')