Update cmd/collect_batch.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Snider 2026-02-02 06:44:19 +00:00 committed by GitHub
parent fd271f8bd9
commit 0521d835e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -128,13 +128,18 @@ func downloadURL(cmd *cobra.Command, u, outputDir string, skipExisting bool, del
}
}
resp, err := http.Get(u)
resp, err := httpClient.Get(u)
if err != nil {
logMessage(cmd, fmt.Sprintf("Error downloading %s: %v", u, err), bar, outMutex)
return
}
defer resp.Body.Close()
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
logMessage(cmd, fmt.Sprintf("HTTP error %d for %s", resp.StatusCode, u), bar, outMutex)
return
}
out, err := os.Create(filePath)
if err != nil {
logMessage(cmd, fmt.Sprintf("Error creating file for %s: %v", u, err), bar, outMutex)