[MERGE] urlutils.rebase_url handles '..' path segments in 'url'
Michael Hudson
michael.hudson at canonical.com
Tue Jul 22 04:01:04 BST 2008
Playing around while trying to fix bug 250418 which is to do with
branches referring to their stacked on url by relative paths, I was
surprised by (what turned out to be) this behaviour:
>>> from bzrlib.urlutils import rebase_url
>>> rebase_url('../bar', 'foo/quux', '')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "bzrlib/urlutils.py", line 670, in rebase_url
osutils.pathjoin(old_parsed[2], url))
File "bzrlib/urlutils.py", line 676, in determine_relative_path
to_segments = osutils.splitpath(to_path)
File "bzrlib/osutils.py", line 788, in splitpath
raise errors.BzrError("sorry, %r not allowed in path" % f)
bzrlib.errors.BzrError: sorry, '..' not allowed in path
>>>
This branch changes it to act like this:
>>> from bzrlib.urlutils import rebase_url
>>> rebase_url('../bar', 'foo/quux', '')
'foo/bar'
>>>
I'm not sure that 'join' is necessarily the right thing to use though --
osutils.normpath(osutils.pathjoin()) would probably work just as well.
Something should change though I think :)
Cheers,
mwh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rebase-paths-3568.patch
Type: text/x-patch
Size: 3499 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080722/7a6b56b4/attachment-0001.bin
More information about the bazaar
mailing list