Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
Consider any HTTP response code > 399 as an error (#3834)
Browse files Browse the repository at this point in the history
  • Loading branch information
ycombinator authored May 7, 2024
1 parent 19b3c81 commit 88ec185
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pkg/downloads/releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (r *ArtifactURLResolver) Resolve() (string, string, error) {
return backoff.Permanent(err)
}

if resp.StatusCode == http.StatusNotFound {
if resp.StatusCode > 399 {
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
}

Expand Down Expand Up @@ -242,7 +242,7 @@ func (as *ArtifactsSnapshotVersion) GetSnapshotArtifactVersion(project string, v
return backoff.Permanent(err)
}

if resp.StatusCode == http.StatusNotFound {
if resp.StatusCode > 399 {
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
}

Expand Down Expand Up @@ -380,7 +380,7 @@ func (asur *ArtifactsSnapshotURLResolver) Resolve() (string, string, error) {
return backoff.Permanent(err)
}

if resp.StatusCode == http.StatusNotFound {
if resp.StatusCode > 399 {
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
}

Expand Down Expand Up @@ -497,7 +497,7 @@ func (r *ReleaseURLResolver) Resolve() (string, string, error) {
defer resp.Body.Close()
_, _ = io.Copy(io.Discard, resp.Body)

if resp.StatusCode == http.StatusNotFound {
if resp.StatusCode > 399 {
return backoff.Permanent(fmt.Errorf("not found for url %s", url))
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/downloads/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func GetElasticArtifactVersion(version string) (string, error) {
return fmt.Errorf("error getting %s: %w", url, err)
}

if resp.StatusCode == http.StatusNotFound {
if resp.StatusCode > 399 {
return backoff.Permanent(fmt.Errorf("version %s not found at %s", version, url))
}

Expand Down

0 comments on commit 88ec185

Please sign in to comment.