diff --git a/sflock/unpack/zip.py b/sflock/unpack/zip.py index 66dc39c6..79bd191d 100644 --- a/sflock/unpack/zip.py +++ b/sflock/unpack/zip.py @@ -43,6 +43,18 @@ def _decrypt(self, archive, entry, password): contents=archive.read(entry), password=password ) + except NotImplementedError as nae: + # Deflate64 + # Instead of throwing an UnpackException return failed. + # TODO: 7z supports this format, so pick could be updated to detect this + # compression type and use the 7z unpacker instead. + # + if "compression type 9" in nae.args[0]: + return File( + relapath=entry.filename, + mode="failed", + description="%s" % nae + ) except RuntimeError as e: if "password required" not in e.args[0] and \ "Bad password" not in e.args[0]: diff --git a/tests/files/zip_deflate64.zip b/tests/files/zip_deflate64.zip new file mode 100644 index 00000000..33581455 Binary files /dev/null and b/tests/files/zip_deflate64.zip differ diff --git a/tests/test_zip.py b/tests/test_zip.py index 8607e3d3..2a2edace 100644 --- a/tests/test_zip.py +++ b/tests/test_zip.py @@ -130,3 +130,13 @@ def test_garbage2(self): assert len(files) == 1 assert not files[0].children assert files[0].mode == "failed" + + def test_deflate64(self): + t = ZipFile(f("zip_deflate64.zip")) + assert t.handles() is True + assert not t.f.selected + files = t.unpack() + assert len(files) == 1 + assert not files[0].children + assert files[0].mode == "failed" +