mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
internal/download: show progress bar only if server gives length
This commit is contained in:
parent
ac85a6f254
commit
815a6016f9
1 changed files with 4 additions and 1 deletions
|
|
@ -205,7 +205,10 @@ func (db *ChecksumDB) DownloadFile(url, dstPath string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
dst := newDownloadWriter(fd, resp.ContentLength)
|
var dst io.WriteCloser = fd
|
||||||
|
if resp.ContentLength > 0 {
|
||||||
|
dst = newDownloadWriter(fd, resp.ContentLength)
|
||||||
|
}
|
||||||
_, err = io.Copy(dst, resp.Body)
|
_, err = io.Copy(dst, resp.Body)
|
||||||
dst.Close()
|
dst.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue