diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-20 01:25:05 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-10-20 01:25:05 +0200 |
commit | b05796e64c51ab5e9326a212636aff3f414abd81 (patch) | |
tree | 85df7df64760024ceb1e6dd6d5756357414d7a96 /module | |
parent | Merge pull request #2063 from Gutz-Pilz/patch-7 (diff) | |
parent | [UnZip] fix verify() (diff) | |
download | pyload-b05796e64c51ab5e9326a212636aff3f414abd81.tar.xz |
Merge pull request #2074 from GammaC0de/patch-6
[UnZip] update
Diffstat (limited to 'module')
-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): |