fix(update): strip hyphenated suffix from version string during comparison

When running a custom build or pre-release version (e.g. v0.1.183-custom),
parseVersion failed to parse the patch segment because of the non-numeric suffix,
causing compareVersions to incorrectly report an available update.

This commit strips any hyphenated suffix before splitting SemVer components.

Signed-off-by: WUJI-Labs <zoujincool@gmail.com>
This commit is contained in:
WUJI-Labs
2026-08-27 15:54:22 +08:00
parent efb46db0a9
commit 9e7aff59df
@@ -655,6 +655,9 @@ func compareVersions(current, latest string) int {
func parseVersion(v string) [3]int {
v = strings.TrimPrefix(v, "v")
if idx := strings.IndexByte(v, '-'); idx != -1 {
v = v[:idx]
}
parts := strings.Split(v, ".")
result := [3]int{0, 0, 0}
for i := 0; i < len(parts) && i < 3; i++ {