[patch] urlutils.join() should handle trailing slashes better

John Arbash Meinel john at arbash-meinel.com
Thu Jun 15 22:29:05 BST 2006


Wouter van Heyst wrote:
> On Thu, Jun 15, 2006 at 04:06:24PM -0500, John Arbash Meinel wrote:

...

>> === modified file 'bzrlib/tests/test_urlutils.py'
>> --- bzrlib/tests/test_urlutils.py	2006-06-15 01:58:02 +0000
>> +++ bzrlib/tests/test_urlutils.py	2006-06-15 21:04:22 +0000
>> @@ -209,6 +209,13 @@
>>          test('http://bar', 'http://foo', 'http://bar')
>>          test('sftp://bzr/foo', 'http://foo', 'bar', 'sftp://bzr/foo')
>>          test('file:///bar', 'foo', 'file:///bar')
>> +
>> +        # From a base path
>> +        test('file:///foo', 'file:///', 'foo')
>> +        test('file:///bar/foo', 'file:///bar/', 'foo')
>> +        test('http://host/foo', 'http://host/', 'foo')
> 
>> +        test('http://host/foo', 'http://host', 'foo')
> 
> Isn't this redundant with test('http://foo/bar', 'http://foo', 'bar')
> earlier on? Otherwise +1.
> 
> Wouter van Heyst

No, because http://host has no path, while 'http://host/foo' has the
path '/foo'.

A lot of the urlutils functions have to know about the difference
between the stuff before and after the third slash in a url. Because if
you do urlutils.split('http://host'), you should get back
('http://host', '') not ('http:/', 'host')

So with urls we don't just have a plain path, parts of it have to be
handle specially.

John
=:->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060615/bbf164ab/attachment.pgp 


More information about the bazaar mailing list