From 63d6410bb4744437d51fb9ab196d26fa3bbe8ef6 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Fri, 31 Oct 2025 08:12:38 +1100 Subject: [PATCH] BE: handle missing buildtimestamp.txt Signed-off-by: jokob-sk --- server/helper.py | 12 ++++++++++-- server/initialise.py | 9 ++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/server/helper.py b/server/helper.py index 263ac5b2..bb74ef5a 100755 --- a/server/helper.py +++ b/server/helper.py @@ -773,8 +773,16 @@ def checkNewVersion(): newVersion = False - with open(applicationPath + '/front/buildtimestamp.txt', 'r') as f: - buildTimestamp = int(f.read().strip()) + build_timestamp_path = os.path.join(applicationPath, 'front/buildtimestamp.txt') + + # Ensure file exists, initialize if missing + if not os.path.exists(build_timestamp_path): + with open(build_timestamp_path, 'w') as f: + f.write("0") + + # Now safely read the timestamp + with open(build_timestamp_path, 'r') as f: + buildTimestamp = int(f.read().strip() or 0) try: response = requests.get( diff --git a/server/initialise.py b/server/initialise.py index 52e09d12..ac8062a1 100755 --- a/server/initialise.py +++ b/server/initialise.py @@ -378,7 +378,14 @@ def importConfigs (pm, db, all_plugins): # HANDLE APP was upgraded message - clear cache # Check if app was upgraded - with open(applicationPath + '/front/buildtimestamp.txt', 'r') as f: + build_timestamp_path = os.path.join(applicationPath, 'front/buildtimestamp.txt') + + # Ensure the build timestamp file exists and has an initial value + if not os.path.exists(build_timestamp_path): + with open(build_timestamp_path, 'w') as f: + f.write("0") + + with open(build_timestamp_path, 'r') as f: buildTimestamp = int(f.read().strip()) cur_version = conf.VERSION