Skip to content

Commit

Permalink
fail pkg/downloader if statuscode >= 400
Browse files Browse the repository at this point in the history
  • Loading branch information
dave-gray101 committed Feb 28, 2024
1 parent a783ab5 commit aa02d22
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/downloader/uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ func DownloadFile(url string, filePath, sha string, downloadStatus func(string,
}
defer resp.Body.Close()

if resp.StatusCode >= 400 {
return fmt.Errorf("failed to download file %q, invalid status code %d", filePath, resp.StatusCode)
}

// Create parent directory
err = os.MkdirAll(filepath.Dir(filePath), 0755)
if err != nil {
Expand Down

0 comments on commit aa02d22

Please sign in to comment.