fix: panic while create empty file

pull/1604/head
Noah Hsu 2022-09-03 19:32:44 +08:00
parent 552aba997c
commit dcc99802ec
1 changed files with 1 additions and 1 deletions

View File

@ -31,7 +31,7 @@ func CopyWithCtx(ctx context.Context, out io.Writer, in io.Reader, size int64, p
default:
// otherwise just run default io.Reader implementation
n, err := in.Read(p)
if err == nil || err == io.EOF {
if s > 0 && (err == nil || err == io.EOF) {
finish += int64(n)
progress(int(finish / s))
}