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

Wouter van Heyst larstiq at larstiq.dyndns.org
Thu Jun 15 22:26:12 BST 2006


On Thu, Jun 15, 2006 at 04:06:24PM -0500, John Arbash Meinel wrote:
> I was trying to write some other tests, and I came across this bug.
> Basically, urlutils.join() gives a bad output when the base is the root
> path. (like file:/// or http://host/)
> 
> The old code would do:
> 
> urlutils.join('file:///', 'foo') => 'file:////foo'
> The new code returns:
> urlutils.join('file:///', 'foo') => 'file:///foo'
> 
> As you would expect.
> 
> I added a few tests, etc.
> 
> John
> =:->

> === 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




More information about the bazaar mailing list