From de5bf3fd614b479f68766c2bb9669ca7b9dcdc29 Mon Sep 17 00:00:00 2001 From: EstrellaXD Date: Wed, 30 Aug 2023 01:24:27 +0800 Subject: [PATCH] fix: unexpected version update. --- backend/src/module/update/version_check.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/src/module/update/version_check.py b/backend/src/module/update/version_check.py index 7fbfc2b6..91550bdf 100644 --- a/backend/src/module/update/version_check.py +++ b/backend/src/module/update/version_check.py @@ -3,9 +3,10 @@ from module.conf import VERSION def version_check() -> bool: with open("config/version.txt", "rw") as f: - version = f.read() - if VERSION > version: - f.write(VERSION) + # Read last version + versions = f.readlines() + if VERSION[:3] > versions[-1][:3]: + f.write(VERSION[:3] + "\n") return False else: return True