summaryrefslogtreecommitdiffstats
path: root/module/plugins/internal
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/internal')
-rw-r--r--module/plugins/internal/UnZip.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/module/plugins/internal/UnZip.py b/module/plugins/internal/UnZip.py
index 053946dbe..52e279ccf 100644
--- a/module/plugins/internal/UnZip.py
+++ b/module/plugins/internal/UnZip.py
@@ -3,12 +3,12 @@
import sys
import zipfile
-from module.plugins.internal.AbstractExtractor import AbtractExtractor
+from module.plugins.internal.AbstractExtractor import AbtractExtractor, WrongPassword, ArchiveError
class UnZip(AbtractExtractor):
__name__ = "UnZip"
- __version__ = "0.10"
+ __version__ = "0.11"
__description__ = """Zip extractor plugin"""
__license__ = "GPLv3"
@@ -32,9 +32,19 @@ class UnZip(AbtractExtractor):
def extract(self, progress, password=None):
- z = zipfile.ZipFile(self.file)
- self.files = z.namelist()
- z.extractall(self.out)
+ try:
+ z = zipfile.ZipFile(self.file)
+ self.files = z.namelist()
+ z.extractall(self.out, pwd=password)
+
+ except (BadZipfile, LargeZipFile), e:
+ raise ArchiveError(e)
+
+ except RuntimeError, e:
+ if e is "Bad password for file":
+ raise WrongPassword
+ else:
+ raise ArchiveError(e)
def getDeleteFiles(self):