Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download file content is not valid if use ChunkSize is bigger than the file content size #68

Open
simonwu-os opened this issue Dec 24, 2022 · 0 comments

Comments

@simonwu-os
Copy link

I use --chunk 5242880 to specify ChunkSize.
If the size of the target file is less then 5M, the content downloaded is not valid. Its sha256 is not right.
I check the source code, I find it has a bug. When d.info.Size is less than d.ChunkSize, then chunksLen is zero.

I fix it in my fork https://github.com/simonwu-os/got.
It works fine.

chunksLen := d.info.Size / d.ChunkSize
///added by simon wu
///fix if chunksLen = 0, then the result file content is not valid.
if chunksLen == 0 {
chunksLen += 1
}
///end of added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant