summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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):