Update cmd/collect_batch.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
parent
fd271f8bd9
commit
0521d835e7
1 changed files with 6 additions and 1 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue