Skip to content
New issue

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

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

Already on GitHub? # to your account

Do not split download if no "Content-length" #87

Merged
merged 1 commit into from
May 19, 2022
Merged

Conversation

rlaker
Copy link
Contributor

@rlaker rlaker commented May 19, 2022

The server I was downloading from does not return a "Content-length" in the response, leading to a KeyError and a failed download.

I did get it working when DISABLE_RANGE was set, but since this is an environment variable I cannot change this in the code, since other servers I download from do return "Content-length".

I have now added an extra statement to check if "Content-length" is in the response, otherwise do not try and split the download.

Let me know what you think.

@codecov
Copy link

codecov bot commented May 19, 2022

Codecov Report

Merging #87 (30ebdf4) into main (9afc7cf) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #87   +/-   ##
=======================================
  Coverage   91.52%   91.52%           
=======================================
  Files           4        4           
  Lines         425      425           
=======================================
  Hits          389      389           
  Misses         36       36           
Impacted Files Coverage Δ
parfive/downloader.py 94.85% <100.00%> (ø)

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 9afc7cf...30ebdf4. Read the comment docs.

Copy link
Owner

@Cadair Cadair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks a lot for the PR :)

@Cadair Cadair merged commit bd16c83 into Cadair:main May 19, 2022
@Cadair
Copy link
Owner

Cadair commented May 19, 2022

I need to fix the CI and then I shall make a release 😄

@Cadair Cadair added the bug A report of or a fix for a bug or unwanted behaviour label Jun 9, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug A report of or a fix for a bug or unwanted behaviour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants