Skip to content

Commit

Permalink
[downloader/http] Fix access to not yet opened stream in retry
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw committed Sep 21, 2020
1 parent b557159 commit 0837992
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions youtube_dl/downloader/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ def download():

def retry(e):
to_stdout = ctx.tmpfilename == '-'
if not to_stdout:
ctx.stream.close()
ctx.stream = None
if ctx.stream is not None:
if not to_stdout:
ctx.stream.close()
ctx.stream = None
ctx.resume_len = byte_counter if to_stdout else os.path.getsize(encodeFilename(ctx.tmpfilename))
raise RetryDownload(e)

Expand Down

0 comments on commit 0837992

Please sign in to comment.