
link#absolute_href is broken
Reported by dstar | January 26th, 2009 @ 02:25 PM | in 0.4.2
There is a bug in link#absolute_href:
54 def absolute_href 55 if href =~ /^\?/ 56 "#{@session.current_url}#{href}" 57 elsif href !~ %r{^https?://www.example.com(/.*)} && (href !~ /^\//) 58 "#{@session.current_url}/#{href}" 59 else 60 href 61 end 62 end
I'm not positive, but I think Line 55 should be:
if href =~ /^\/?/
unless it's meant to be checking for urls that begin with '?'? If so, it would turn ?foo into 'http://foo.bar.baz?foo', which I'm not sure is legal.
Line 57 should not check for the existence of www.example.com, as that causes it to
fail on absolute urls. Assuming that I'm right about line 55, it
should also not check that href is a relative url, as it can never
be reached if it is:
elsif href !~ %r{^https?://[^/]+(/.*)}
Comments and changes to this ticket
-
Bryan Helmkamp January 26th, 2009 @ 02:29 PM
- Milestone set to 0.4.1
- State changed from new to open
- Assigned user set to Bryan Helmkamp
-
Bryan Helmkamp February 8th, 2009 @ 11:23 PM
- Milestone changed from 0.4.1 to 0.4.2
-
gaffo June 3rd, 2009 @ 10:14 AM
- Tag set to stale
dstar,
It's been quite a while, is this still an issue or should I close this ticket?
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Ruby Acceptance Testing for Web applications.