bugfix: Handle update failed update checks silently (#342)

This commit is contained in:
James Read 2024-06-30 23:05:04 +01:00 committed by GitHub
parent eb4f28dfda
commit fb972fae55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 8 deletions

View File

@ -47,15 +47,15 @@ func parseVersion(input []byte) string {
err := json.Unmarshal(input, &versionMap) err := json.Unmarshal(input, &versionMap)
if err != nil { if err != nil {
log.Warnf("Update check unmarshal failure: %v", err) log.Errorf("Update check unmarshal failure: %v", err)
return "error-during-check" return "none"
} else { } 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 { if installationinfo.Build.Version == versionMap.Latest {
return versionMap.Latest
} else {
return "none" return "none"
} else {
return versionMap.Latest
} }
} }
} }
@ -65,14 +65,14 @@ func doRequest() string {
if err != nil { if err != nil {
log.Errorf("Update check failed %v", err) log.Errorf("Update check failed %v", err)
return "" return "none"
} }
resp, err := http.DefaultClient.Do(req) resp, err := http.DefaultClient.Do(req)
if err != nil { if err != nil {
log.Errorf("Update check failed %v", err) log.Errorf("Update check failed %v", err)
return "" return "none"
} }
versionMap, _ := io.ReadAll(resp.Body) versionMap, _ := io.ReadAll(resp.Body)