Cadair / parfive

An asyncio based parallel file downloader for Python 3.8+
https://parfive.readthedocs.io/
MIT License
51 stars 24 forks source link

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

Closed rlaker closed 2 years ago

rlaker commented 2 years ago

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[bot] commented 2 years ago

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.

Cadair commented 2 years ago

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