Skip to content

Commit

Permalink
修复下载文件报unexpected EOF的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jsyzchen committed Aug 5, 2021
1 parent c816d83 commit f6e30dd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion utils/file/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ func (d *Downloader) downloadPart(c Part) error {
defer resp.Body.Close()
bs, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
if err != io.EOF && err != io.ErrUnexpectedEOF {//unexpected EOF 处理
log.Println("ioutil.ReadAll error :", err)
return err
}
}
if len(bs) != (c.To - c.From + 1) {
return errors.New("下载文件分片长度错误")
Expand Down

0 comments on commit f6e30dd

Please sign in to comment.