# Buggy code
def async_download(self, stop_request=None):
    headers = requests.utils.default_headers()
    headers["User-Agent"] = "Lutris/%s" % __version__
    if self.referer:
        headers["Referer"] = self.referer
    response = requests.get(self.url, headers=headers, stream=True)
    self.full_size = int(response.headers.get("Content-Length", "").strip() or 0)
    for chunk in response.iter_content(chunk_size=1024 * 1024):
        if not self.file_pointer:
            break
        if chunk:
            self.downloaded_size += len(chunk)
            self.file_pointer.write(chunk)


# Traceback (tarfile.ReadError)
DEBUG    2019-11-26 02:20:55,510 [application.launch:339]:Launching Overwatch (wine) (139814221039744)
DEBUG    2019-11-26 02:20:55,543 [game.play:295]:Prelaunching <lutris.runners.wine.wine object at 0x7f290bc16c10>
DEBUG    2019-11-26 02:20:55,765 [downloader.start:55]:Starting download of:
https://github.com/doitsujin/dxvk/releases/download/vdxvk-time2/dxvk-dxvk-time2.tar.gz
DEBUG    2019-11-26 02:20:56,518 [downloader.on_done:97]:Finished downloading https://github.com/doitsujin/dxvk/releases/download/vdxvk-time2/dxvk-dxvk-time2.tar.gz
DEBUG    2019-11-26 02:20:56,668 [extract.extract_archive:69]:Extracting /home/alex/.local/share/lutris/runtime/dxvk/dxvk-dxvk-time2.tar.gz to /home/alex/.local/share/lutris/runtime/dxvk/dxvk-time2
ERROR    2019-11-26 02:20:56,668 [extract.extract_archive:116]:Extraction failed: not a gzip file
Traceback (most recent call last):
File "/usr/lib/python3.8/tarfile.py", line 1671, in gzopen
t = cls.taropen(name, mode, fileobj, **kwargs)
File "/usr/lib/python3.8/tarfile.py", line 1647, in taropen
return cls(name, mode, fileobj, **kwargs)
File "/usr/lib/python3.8/tarfile.py", line 1510, in __init__
self.firstmember = self.next()
File "/usr/lib/python3.8/tarfile.py", line 2313, in next
tarinfo = self.tarinfo.fromtarfile(self)
File "/usr/lib/python3.8/tarfile.py", line 1102, in fromtarfile
buf = tarfile.fileobj.read(BLOCKSIZE)
File "/usr/lib/python3.8/gzip.py", line 286, in read
return self._buffer.read(size)
File "/usr/lib/python3.8/_compression.py", line 68, in readinto
data = self.read(len(byte_view))
File "/usr/lib/python3.8/gzip.py", line 473, in read
if not self._read_gzip_header():
File "/usr/lib/python3.8/gzip.py", line 421, in _read_gzip_header
raise BadGzipFile('Not a gzipped file (%r)' % magic)
gzip.BadGzipFile: Not a gzipped file (b'No')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/lutris/util/extract.py", line 114, in extract_archive
_do_extract(path, temp_path, opener, mode, extractor)
File "/usr/lib/python3.8/site-packages/lutris/util/extract.py", line 166, in _do_extract
handler = opener(archive, mode)
File "/usr/lib/python3.8/tarfile.py", line 1617, in open
return func(name, filemode, fileobj, **kwargs)
File "/usr/lib/python3.8/tarfile.py", line 1675, in gzopen
raise ReadError("not a gzip file")
tarfile.ReadError: not a gzip file
ERROR    2019-11-26 02:20:56,669 [jobs.target:32]:Error while completing task <bound method wine.prelaunch of <lutris.runners.wine.wine object at 0x7f290bc16c10>>: not a gzip file
<class 'lutris.util.extract.ExtractFailure'> not a gzip file
File "/usr/lib/python3.8/site-packages/lutris/util/jobs.py", line 30, in target
result = self.function(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/lutris/runners/wine.py", line 794, in prelaunch
self.setup_dxvk(
File "/usr/lib/python3.8/site-packages/lutris/runners/wine.py", line 775, in setup_dxvk
self.toggle_dxvk(
File "/usr/lib/python3.8/site-packages/lutris/runners/wine.py", line 760, in toggle_dxvk
dxvk_manager.download()
File "/usr/lib/python3.8/site-packages/lutris/util/wine/dxvk.py", line 142, in download
extract_archive(dxvk_archive_path, self.dxvk_path, merge_single=True)
File "/usr/lib/python3.8/site-packages/lutris/util/extract.py", line 117, in extract_archive
raise ExtractFailure(str(ex))
ERROR    2019-11-26 02:20:56,669 [game.configure_game:312]:not a gzip file
ERROR    2019-11-26 02:20:58,157 [game.configure_game:315]:Game prelaunch unsuccessful
TypeError: refresh() takes 1 positional argument but 3 were given

# Fixed code
def async_download(self, stop_request=None):
    headers = requests.utils.default_headers()
    headers["User-Agent"] = "Lutris/%s" % __version__
    if self.referer:
        headers["Referer"] = self.referer
    response = requests.get(self.url, headers=headers, stream=True)
    if response.status_code != 200:
        logger.info("%s returned a %s error" % (self.url, response.status_code))
    response.raise_for_status()
    self.full_size = int(response.headers.get("Content-Length", "").strip() or 0)
    for chunk in response.iter_content(chunk_size=1024 * 1024):
        if not self.file_pointer:
            break
        if chunk:
            self.downloaded_size += len(chunk)
            self.file_pointer.write(chunk)