From fb972fae556f9849ba1b07e6a0da99d1b68e7354 Mon Sep 17 00:00:00 2001 From: James Read Date: Sun, 30 Jun 2024 23:05:04 +0100 Subject: [PATCH] bugfix: Handle update failed update checks silently (#342) --- internal/updatecheck/updateCheck.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/updatecheck/updateCheck.go b/internal/updatecheck/updateCheck.go index 6073a11..fb02f4d 100644 --- a/internal/updatecheck/updateCheck.go +++ b/internal/updatecheck/updateCheck.go @@ -47,15 +47,15 @@ func parseVersion(input []byte) string { err := json.Unmarshal(input, &versionMap) if err != nil { - log.Warnf("Update check unmarshal failure: %v", err) - return "error-during-check" + log.Errorf("Update check unmarshal failure: %v", err) + return "none" } else { - log.Infof("Update check remote version: %+v", versionMap) + log.Infof("Update check remote version: %+v, latest version: %+v", versionMap.Latest, installationinfo.Build.Version) - if installationinfo.Build.Version != versionMap.Latest { - return versionMap.Latest - } else { + if installationinfo.Build.Version == versionMap.Latest { return "none" + } else { + return versionMap.Latest } } } @@ -65,14 +65,14 @@ func doRequest() string { if err != nil { log.Errorf("Update check failed %v", err) - return "" + return "none" } resp, err := http.DefaultClient.Do(req) if err != nil { log.Errorf("Update check failed %v", err) - return "" + return "none" } versionMap, _ := io.ReadAll(resp.Body)