Commit a73e7d2e by Őry Máté Committed by Mate Ory

disk: fix typo in magic decompression (bz2)

parent 7de1a3f5
...@@ -210,6 +210,8 @@ class Disk(object): ...@@ -210,6 +210,8 @@ class Disk(object):
# undocumented zlib feature http://stackoverflow.com/a/2424549 # undocumented zlib feature http://stackoverflow.com/a/2424549
elif ext == 'bz2': elif ext == 'bz2':
decompressor = BZ2Decompressor() decompressor = BZ2Decompressor()
else:
decompressor = None
clen = int(r.headers.get('content-length', maximum_size)) clen = int(r.headers.get('content-length', maximum_size))
if clen > maximum_size: if clen > maximum_size:
raise FileTooBig() raise FileTooBig()
...@@ -217,7 +219,7 @@ class Disk(object): ...@@ -217,7 +219,7 @@ class Disk(object):
try: try:
with open(disk_path, 'wb') as f: with open(disk_path, 'wb') as f:
for chunk in r.iter_content(chunk_size=chunk_size): for chunk in r.iter_content(chunk_size=chunk_size):
if ext in ('gz', 'bz'): if decompressor:
chunk = decompressor.decompress(chunk) chunk = decompressor.decompress(chunk)
f.write(chunk) f.write(chunk)
actsize = f.tell() actsize = f.tell()
......
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 sign in to comment