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

« back to all changes in this revision

Viewing changes to lib/common/zip.py

  • Committer: dcoles
  • Date: 2008-07-14 01:08:59 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:850
Console: Moved console up into dispatch. Now any application can, in theory, 
have it's own console just by adding 'useconsole = True' to the app settings.
Note: There are some cases where this may not be a good idea - ie. The full 
console app, public applications, etc. Removed the old single instances of 
console and made apps init functions use the new scripts_init section.

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):