Private GIT

Skip to content
Snippets Groups Projects
Unverified Commit 2e5997cc authored by miigotu's avatar miigotu Committed by GitHub
Browse files

Fix issue with jackett hopefully (untested) (#4152)

parent 412686d3
Branches
No related tags found
No related merge requests found
......@@ -1489,6 +1489,12 @@ def download_file(url, filename, session=None, headers=None, **kwargs): # pylin
resp.raise_for_status()
# Workaround for jackett.
if resp.headers.get('content-type') == 'application/x-bittorrent':
group = re.findall('filename=["\'](.+)["\']', resp.headers.get('content-disposition', ''))
if group:
filename = group[0]
try:
with io.open(filename, 'wb') as fp:
for chunk in resp.iter_content(chunk_size=1024):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment