Because ZnUrl>>#/ is pretty simple and not very intelligent. It is meant for 
path extension. Read the code if you are curious.

What you probably want is ZnUrl>>#withRelativeReference:

'http://www.pharo.org/figures/' asUrl withRelativeReference: 
'/documentation/p.png'. 

"http://www.pharo.org/documentation/p.png";

This implementation is based on an actual specification [RFC 3986 Section 5] 
with a big test suite. But it might still surprise you. It seems to work best 
when the base URL (the left one) points to an actual document (the current HTTP 
page) and the relative URL (the right one) is meant to refer from there.

See the method comment and #testReferenceResolution.

Sven

> On 5 Sep 2021, at 22:01, stephane ducasse <[email protected]> wrote:
> 
> Hi sven
> 
> may be you know the answer :)
> 
> 
> 'http://www.pharo.org/figures/' asUrl / 'documentation/p.png'
> "http://www.pharo.org/figures/documentation/p.png”
> 
> so far so good.
> 
> 
> 'http://www.pharo.org/figures/' asUrl / '/documentation/p.png'
> "http://www.pharo.org/figures//documentation/p.png";
> 
> Why not having 
> 
> "http://www.pharo.org/documentation/p.png”
> 
> Because /documentation is absolute so the resolution could take that into 
> account.
> 
> S

Reply via email to