no guardar archivo si no es 200 OK
This commit is contained in:
parent
acdf974adc
commit
cb930496c9
1 changed files with 3 additions and 0 deletions
3
main.go
3
main.go
|
@ -51,6 +51,9 @@ func (d *Downloader) download(url string, output string, doneChan chan error) {
|
||||||
doneChan <- err
|
doneChan <- err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if res.StatusCode != http.StatusOK {
|
||||||
|
return
|
||||||
|
}
|
||||||
f, err := os.Create(output)
|
f, err := os.Create(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
doneChan <- err
|
doneChan <- err
|
||||||
|
|
Loading…
Reference in a new issue