Skip to content

Commit

Permalink
fix: panic while create empty file
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Sep 3, 2022
1 parent 552aba9 commit dcc9980
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/utils/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit dcc9980

Please sign in to comment.