[Python-Dev] bug in urlparse

Guido van Rossum guido at python.org
Sun Sep 4 16:55:59 CEST 2005

On 9/4/05, Fabien Schwob <skink at evhr.net> wrote:
> Hello,
> I'm using the module urlparse and I think I've found a bug in the
> urlparse module. When you merge an url and a link
> like"../../../page.html" with urljoin, the new url created keep some
> "../" in it. Here is an example :
>  >>> import urlparse
>  >>> begin = "http://www.example.com/folder/page.html"
>  >>> end = "../../../otherpage.html"
>  >>> urlparse.urljoin(begin, end)
> 'http://www.example.com/../../otherpage.html'

You seem to be typing this from memory; the example actually gives a
single set of "../", not two.

> I would more expect the following url :
> http://www.example.com/otherpage.html
> It's what is done in most web browser.
> So I would like to know if it's a bug or not. If it is, I would try to
> code and to submit a patch.

You shouldn't be giving more "../" sequences than are possible. I find
the current behavior acceptable.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list