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

Fix truncated byte (issue #35) #40

Merged
merged 3 commits into from Oct 29, 2019
Merged

Fix truncated byte (issue #35) #40

merged 3 commits into from Oct 29, 2019

Conversation

ghost
Copy link

@ghost ghost commented Oct 28, 2019

This should do the job to solve issue #35

Tested with file sizes / threads from #35 , and with more than 10000 size/thread configuration.

@codecov
Copy link

codecov bot commented Oct 28, 2019

Codecov Report

Merging #40 into master will decrease coverage by 6.46%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #40      +/-   ##
=======================================
- Coverage   80.46%   74%   -6.47%     
=======================================
  Files           5     5              
  Lines         650   650              
=======================================
- Hits          523   481      -42     
- Misses        127   169      +42
Impacted Files Coverage Δ
pySmartDL/pySmartDL.py 71.97% <100%> (-5.5%) ⬇️
pySmartDL/utils.py 77.95% <0%> (-12.6%) ⬇️
pySmartDL/download.py 71.21% <0%> (-9.1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4e71c18...de9aa25. Read the comment docs.

@iTaybb
Copy link
Owner

iTaybb commented Oct 29, 2019

Nice catch. Let me inspect it and I'll merge it soon.

@iTaybb
Copy link
Owner

iTaybb commented Oct 29, 2019

So, few notes:

  1. The rounding issue is from the python2 ages. Thanks for that. I believe this will fix the bug.

  2. I wonder regarding the fix of the filesize-1.
    Since this issue seems to be an off-by-one issue, it might be the solution. However I'm quite baffled:
    since the bytes count goes from 0 to filesize-1 (inclusive), we cannot request byte filesize.
    For example, if we're downloading a 5 bytes file, we would request bytes 0 to 4. Requesting byte would be an error.

What do you think?

@ghost
Copy link
Author

ghost commented Oct 29, 2019

Yes you are totally right, the filesize-1 to filesize won't fix anything !

I will push a correction :)

@ghost
Copy link
Author

ghost commented Oct 29, 2019

Done

And I also round the filesize/threads in the while (threads number verification) like you said before editing your post, I think it is indeed better to check with the same chunck size we will have after

@iTaybb iTaybb merged commit 4066b7c into iTaybb:master Oct 29, 2019
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

Successfully merging this pull request may close these issues.

1 participant