diff options
author | Moritz Haase <Moritz.Haase@bmw.de> | 2022-03-18 10:59:58 +0100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-18 22:19:45 +1100 |
commit | 4b56d428ffda44cf433d7cfdd83ea99417ec3e86 (patch) | |
tree | 2b86c37210873ffb8802d0c208263dec6ab8a6ba /pkg | |
parent | 4fde97b066eef9742c96dac8b5a15468e003ec92 (diff) |
pkg/updates: Fix resource availability check in Updater
When trying to download an update, a 'Could not find any binary at ...' error
message is shown erroneously. This happens since when checking the availability,
a response code of 403 ('Forbidden') instead of 200 ('OK') is expected. Since
'http.Head()' handles redirects automatically, there is no need to also accept
3xx status codes.
Fixes #1450.
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/updates/updates.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pkg/updates/updates.go b/pkg/updates/updates.go index 95fcfa0eb..58c93fa7d 100644 --- a/pkg/updates/updates.go +++ b/pkg/updates/updates.go @@ -329,7 +329,6 @@ func (u *Updater) verifyResourceFound(rawUrl string) bool { } defer resp.Body.Close() u.Log.Info("Received status code ", resp.StatusCode) - // 403 means the resource is there (not going to bother adding extra request headers) - // 404 means its not - return resp.StatusCode == 403 + // OK (200) indicates that the resource is present. + return resp.StatusCode == http.StatusOK } |