Skip to content

Commit

Permalink
Check status code when downloading CI binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Dec 13, 2023
1 parent 6c0134b commit 8d13746
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/gitlab/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ func downloadFile(ctx context.Context, artifactURL, path string) error {
return fmt.Errorf("failed to download artifact: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("failed to download artifact: unexpected response status %d", resp.StatusCode)
}
bar := progressbar.DefaultBytes(
resp.ContentLength,
fmt.Sprintf("Downloading %s", color.CyanString(fileName)),
Expand Down

0 comments on commit 8d13746

Please sign in to comment.