Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/bundle/bundle.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/bundle/bundle.py')
-rw-r--r--src/sugar/bundle/bundle.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
index 0319b9e..e9bd9f8 100644
--- a/src/sugar/bundle/bundle.py
+++ b/src/sugar/bundle/bundle.py
@@ -86,6 +86,9 @@ class Bundle:
del file_names[0]
self._zip_root_dir = file_names[0].split('/')[0]
+ if self._zip_root_dir.startswith('.'):
+ raise MalformedBundleException(
+ 'root directory starts with .')
if self._unzipped_extension is not None:
(name_, ext) = os.path.splitext(self._zip_root_dir)
if ext != self._unzipped_extension:
@@ -162,7 +165,8 @@ class Bundle:
if os.spawnlp(os.P_WAIT, 'unzip', 'unzip', '-o', self._path,
'-x', 'mimetype', '-d', install_dir):
# clean up install dir after failure
- shutil.rmtree(install_dir, ignore_errors=True)
+ shutil.rmtree(os.path.join(install_dir, self._zip_root_dir),
+ ignore_errors=True)
# indicate failure.
raise ZipExtractException