diff options
-rw-r--r-- | module/plugins/internal/UnZip.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py index d26a39f44..c14742efa 100644 --- a/module/plugins/internal/UnZip.py +++ b/module/plugins/internal/UnZip.py @@ -11,7 +11,7 @@ from module.plugins.internal.Extractor import Extractor, ArchiveError, CRCError, class UnZip(Extractor): __name__ = "UnZip" - __version__ = "1.17" + __version__ = "1.18" __status__ = "testing" __description__ = """Zip extractor plugin""" @@ -28,6 +28,11 @@ class UnZip(Extractor): return sys.version_info[:2] >= (2, 6) + @classmethod + def is_multipart(cls, filename): + return False #@NOTE: Unsupported (rarely used anyway) + + def list(self, password=None): with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: z.setpassword(password) @@ -36,12 +41,21 @@ class UnZip(Extractor): def verify(self, password=None): with zipfile.ZipFile(self.target, 'r', allowZip64=True) as z: - badfile = z.testzip() + z.setpassword(password) + + try: + badfile = z.testzip() + + except RuntimeError, e: + if "encrypted" in e.message: + raise PasswordError + else: + raise CRCError("Archive damaged") - if badfile: - raise CRCError(badfile) else: - raise PasswordError + if badfile: + raise CRCError(badfile) + def extract(self, password=None): |