~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-15 07:19:34 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:875
Added "migrations" directory, which contains incremental database update
    scripts.
Updated users.sql, uniqueness key on offering table.
Added migration matching this update to the migrations directory. Mm handy!

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
            # Relative to req.path
52
52
            relpath = os.path.join(basepath, path)
53
53
 
54
 
        _, r = studpath.url_to_local(relpath)
 
54
        #_, r = studpath.url_to_local(relpath)
 
55
        r = relpath
55
56
        if r is None:
56
57
            raise OSError("ZIP: Invalid path")
57
58
        if not os.access(r, os.R_OK):
90
91
    Note: All files go directly into the path. To avoid having a "zip bomb"
91
92
    situation, the zip file should have a single directory in it with all the
92
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).
93
97
    """
94
98
    zip = zipfile.ZipFile(file, 'r')
95
99
    # First test the zip file
97
101
        raise OSError("ZIP: Bad zip file")
98
102
 
99
103
    for filename in zip.namelist():
100
 
        # Work out the name of this file on the local file system, and make
101
 
        # sure it is valid
102
 
        relpath = os.path.join(path, filename)
103
 
        _, localpath = studpath.url_to_local(relpath)
104
 
        if localpath is None:
105
 
            raise OSError("ZIP: Permission denied")
 
104
        localpath = os.path.join(path, filename)
106
105
        # Create directory for filename
107
106
        (file_dir, _) = os.path.split(localpath)
108
107
        if not os.path.exists(file_dir):