Incorrect relative URL handling ? (not ending with /) #218

Open
emmanuelito opened this Issue Feb 27, 2013 · 1 comment

Comments

Projects
None yet
2 participants

Hi

I have a relative HTML link: URL = "foo/bar.html"
in a page fetched from 'https://example.com/base'

If I click the link
links = browser.find_link_by_partial_text('some text')
links[0].click()

I get a 404 error...
because the requested URL is
https://example.com/foo/bar.html
and not
https://example.com/base/foo/bar.html

Note that the base URL does not ends with /

It annoying... I hacked _mechanize.py to fix it, but what would be the correct solution ?

Thanks !
Emmanuel

Member

douglascamata commented Feb 27, 2013

The correct solution would be open a pull request for this in Mechanize. As this source says, the destination of a relative link is relative to the current location, it definitely should go to https://example.com/base/foo/bar.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment