fix: detect branch from folder name for ZIP downloads, preventing false update alerts on nightly/beta builds

This commit is contained in:
Reditus committed 2026-05-14 01:03:28 +01:00
1 parent 748d66b1f1
commit 32a010ed40
1 file changed
+12 -2
+12 -2
View File
@@ -45,13 +45,23 @@ class UpdateService:
self._current_branch = self._detect_branch() self._current_branch = self._detect_branch()
def _detect_branch(self): def _detect_branch(self):
"""Detect the current git branch.""" """Detect the current git branch or ZIP branch from folder name."""
try: try:
branch = subprocess.check_output( branch = subprocess.check_output(
['git', 'rev-parse', '--abbrev-ref', 'HEAD'], ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
cwd=self.project_root, stderr=subprocess.DEVNULL cwd=self.project_root, stderr=subprocess.DEVNULL
).decode().strip() ).decode().strip()
return branch if branch else 'main' if branch:
return branch
except Exception:
pass
folder_name = os.path.basename(self.project_root).lower()
if 'nightly' in folder_name:
return 'nightly'
if 'beta' in folder_name:
return 'beta'
return 'main'
except Exception: except Exception:
return 'main' return 'main'