修复下载接口缺少最后一部分数据的问题

This commit is contained in:
Sydonian 2023-10-20 10:59:56 +08:00
parent e3cdb1a14f
commit 0addcdeb3a
1 changed files with 4 additions and 0 deletions

View File

@ -51,6 +51,10 @@ func (s *ObjectService) Download(ctx *gin.Context) {
ctx.Stream(func(w io.Writer) bool {
rd, err := file.Read(buf)
if err == io.EOF {
err = myio.WriteAll(w, buf[:rd])
if err != nil {
log.Warnf("writing data to response: %s", err.Error())
}
return false
}