summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-10-20 00:51:38 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-10-20 00:51:38 +0200
commite8e1ad71eb01c63720bfc2df0d7be732fab59199 (patch)
treefa9a944d353127aeb6c965b5aa20dabc3a91e48b /module
parentUpdate UnZip.py (diff)
downloadpyload-e8e1ad71eb01c63720bfc2df0d7be732fab59199.tar.xz
[UnZip] fix verify()
Diffstat (limited to 'module')
-rw-r--r--module/plugins/internal/UnZip.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py
index 8788f9ca5..c14742efa 100644
--- a/module/plugins/internal/UnZip.py
+++ b/module/plugins/internal/UnZip.py
@@ -41,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):