-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extract_archive: support deflate64-compressed zip files #282
Conversation
@@ -81,6 +80,26 @@ def __exit__(self, exc_type: None, exc_value: None, traceback: None) -> None: | |||
pass | |||
|
|||
|
|||
class _zipfile: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we didn't need test coverage, this entire class could be replaced by:
try:
import zipfile_deflate64 as zipfile
except ImportError:
import zipfile
If zipfile_deflate64 is not installed and a user opens a deflate64-compressed zip file, they'll see the error message:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/Users/Adam/.spack/.spack-env/._view/tmizjnr2yebouizawyxzmo3gwignw5lz/lib/python3.8/zipfile.py", line 1647, in extractall
self._extract_member(zipinfo, path, pwd)
File "/Users/Adam/.spack/.spack-env/._view/tmizjnr2yebouizawyxzmo3gwignw5lz/lib/python3.8/zipfile.py", line 1700, in _extract_member
with self.open(member, pwd=pwd) as source, \
File "/Users/Adam/.spack/.spack-env/._view/tmizjnr2yebouizawyxzmo3gwignw5lz/lib/python3.8/zipfile.py", line 1571, in open
return ZipExtFile(zef_file, mode, zinfo, pwd, True)
File "/Users/Adam/.spack/.spack-env/._view/tmizjnr2yebouizawyxzmo3gwignw5lz/lib/python3.8/zipfile.py", line 819, in __init__
self._decompressor = _get_decompressor(self._compress_type)
File "/Users/Adam/.spack/.spack-env/._view/tmizjnr2yebouizawyxzmo3gwignw5lz/lib/python3.8/zipfile.py", line 720, in _get_decompressor
_check_compression(compress_type)
File "/Users/Adam/.spack/.spack-env/._view/tmizjnr2yebouizawyxzmo3gwignw5lz/lib/python3.8/zipfile.py", line 700, in _check_compression
raise NotImplementedError("That compression method is not supported")
NotImplementedError: That compression method is not supported
We could potentially catch this error and add a more helpful error message like we do with rarfile, but it isn't clear how to test this (see PR description).
This library might actually be broken: brianhelba/zipfile-deflate64#19 |
a3a1c65
to
9a2a4ff
Compare
3e0b5f5
to
29ba6fb
Compare
Can't tell if RtD is broken or this PR is broken, but I'm going to guess the former. |
29ba6fb
to
306c931
Compare
306c931
to
cab6976
Compare
cab6976
to
1007c6e
Compare
Fixes #59