Skip to content

Commit ade8cef

Browse files
committed
fix: #538 http file download skipped if headResp.ContentLength is 0
1 parent e702211 commit ade8cef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

get_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ func (g *HttpGetter) GetFile(dst string, src *url.URL) error {
443443
if headResp.StatusCode == 200 {
444444
// If the HEAD request succeeded, then attempt to set the range
445445
// query if we can.
446-
if headResp.Header.Get("Accept-Ranges") == "bytes" && headResp.ContentLength >= 0 {
446+
if headResp.Header.Get("Accept-Ranges") == "bytes" && headResp.ContentLength > 0 {
447447
if fi, err := f.Stat(); err == nil {
448448
if _, err = f.Seek(0, io.SeekEnd); err == nil {
449449
currentFileSize = fi.Size()

0 commit comments

Comments
 (0)