internal/download: show progress bar only if server gives length (#33842)
Some checks failed
/ Linux Build (arm) (push) Has been cancelled
/ Keeper Build (push) Has been cancelled
/ Linux Build (push) Has been cancelled
/ Windows Build (push) Has been cancelled
/ Docker Image (push) Has been cancelled

Fixes this:
https://ci.appveyor.com/project/ethereum/go-ethereum/builds/53538177/job/ptosr48pvvwkjskb#L43
This commit is contained in:
Felix Lange 2026-02-14 08:00:03 +01:00 committed by GitHub
parent c50e5edfaf
commit ad88b68a46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -205,7 +205,10 @@ func (db *ChecksumDB) DownloadFile(url, dstPath string) error {
if err != nil {
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)
dst.Close()
if err != nil {