good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 4cc89a5a authored by Felix Lange's avatar Felix Lange Committed by GitHub
Browse files

internal/build: don't crash in DownloadFile when offline (#20595)

parent 15d09038
No related branches found
No related tags found
No related merge requests found
......@@ -83,8 +83,10 @@ func (db *ChecksumDB) DownloadFile(url, dstPath string) error {
fmt.Printf("downloading from %s\n", url)
resp, err := http.Get(url)
if err != nil || resp.StatusCode != http.StatusOK {
return fmt.Errorf("download error: code %d, err %v", resp.StatusCode, err)
if err != nil {
return fmt.Errorf("download error: %v", err)
} else if resp.StatusCode != http.StatusOK {
return fmt.Errorf("download error: status %d", resp.StatusCode)
}
defer resp.Body.Close()
if err := os.MkdirAll(filepath.Dir(dstPath), 0755); err != nil {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment