Fix project root path calculation in version and update functions

- Correct path traversal from 4 to 3 levels up (server -> auracast -> src -> bumble-auracast)
- Add clarifying comments for path calculation
- Apply fix consistently across get_version(), check_update(), and system_update() functions
This commit is contained in:
2026-01-05 16:02:24 +01:00
parent 8549691e67
commit a61d7b0868
+6 -4
View File
@@ -903,7 +903,8 @@ async def system_reboot():
async def get_version():
"""Get the current software version (git tag or commit)."""
try:
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# server -> auracast -> src -> bumble-auracast (3 levels up)
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# Try to get the current tag
proc = await asyncio.create_subprocess_exec(
@@ -937,7 +938,8 @@ async def get_version():
async def check_update():
"""Check for available updates by comparing current version with latest release tag."""
try:
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# server -> auracast -> src -> bumble-auracast (3 levels up)
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# Fetch all tags and refs from origin
proc = await asyncio.create_subprocess_exec(
@@ -993,8 +995,8 @@ async def system_update():
except Exception:
pass
# Project root is 4 levels up from this file: server -> auracast -> src -> bumble-auracast
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..'))
# server -> auracast -> src -> bumble-auracast (3 levels up)
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
# 1. Fetch and checkout the latest tag from the release branch
# First fetch all tags and the release branch