~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to lib/common/zip.py

  • Committer: mattgiuca
  • Date: 2008-07-27 10:29:16 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:954
Added svn:ignore on some directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
    Note: All files go directly into the path. To avoid having a "zip bomb"
92
92
    situation, the zip file should have a single directory in it with all the
93
93
    files.
 
94
    The path is an absolute path in the current filesystem
 
95
    (if this code is executed inside the jail, then it's inside the jail,
 
96
    if it's not then it's not).
94
97
    """
95
98
    zip = zipfile.ZipFile(file, 'r')
96
99
    # First test the zip file
98
101
        raise OSError("ZIP: Bad zip file")
99
102
 
100
103
    for filename in zip.namelist():
101
 
        # Work out the name of this file on the local file system, and make
102
 
        # sure it is valid
103
 
        relpath = os.path.join(path, filename)
104
 
        _, localpath = studpath.url_to_local(relpath)
105
 
        if localpath is None:
106
 
            raise OSError("ZIP: Permission denied")
 
104
        localpath = os.path.join(path, filename)
107
105
        # Create directory for filename
108
106
        (file_dir, _) = os.path.split(localpath)
109
107
        if not os.path.exists(file_dir):