~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ftp.py

Fix the FTP transport's handling of abspath('/')

Show diffs side-by-side

added added

removed removed

Lines of Context:
196
196
    def _abspath(self, relpath):
197
197
        assert isinstance(relpath, basestring)
198
198
        relpath = urlutils.unescape(relpath)
199
 
        relpath_parts = relpath.split('/')
200
 
        if len(relpath_parts) > 1:
201
 
            if relpath_parts[0] == '':
202
 
                raise ValueError("path %r within branch %r seems to be absolute"
203
 
                                 % (relpath, self._path))
204
 
        basepath = self._path.split('/')
 
199
        if relpath.startswith('/'):
 
200
            basepath = []
 
201
        else:
 
202
            basepath = self._path.split('/')
205
203
        if len(basepath) > 0 and basepath[-1] == '':
206
204
            basepath = basepath[:-1]
207
 
        for p in relpath_parts:
 
205
        for p in relpath.split('/'):
208
206
            if p == '..':
209
207
                if len(basepath) == 0:
210
208
                    # In most filesystems, a request for the parent