Unverified Commit 488f36b4 authored by Mustafa Bal's avatar Mustafa Bal Committed by GitHub
Browse files

Fixed URLContext Leak (#1429)

parent 6d5e0ba6
...@@ -29,7 +29,8 @@ def stream_url(url: str, ...@@ -29,7 +29,8 @@ def stream_url(url: str,
# If we already have the whole file, there is no need to download it again # If we already have the whole file, there is no need to download it again
req = urllib.request.Request(url, method="HEAD") req = urllib.request.Request(url, method="HEAD")
url_size = int(urllib.request.urlopen(req).info().get("Content-Length", -1)) with urllib.request.urlopen(req) as response:
url_size = int(response.info().get("Content-Length", -1))
if url_size == start_byte: if url_size == start_byte:
return return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment