Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Double encoding links

#29

It seems that links with %20's get double encoded while trying to strip the anchor off.

For example, if a page contains the link:

/Company%20Info/103070.aspx

It will change it to:

/Company%2520Info/103070.aspx

... which is bogus.

In page.rb line 138

    def to_absolute(link)
      return nil if link.nil?

      # remove anchor
      link = URI.encode(link.to_s.gsub(/#[a-zA-Z0-9_-]*$/,'')) # <== this encode mucks up the url

      relative = URI(link)
      absolute = @url.merge(relative)

      absolute.path = '/' if absolute.path.empty?

      return absolute
    end

I think what you want it to be is:

    def to_absolute(link)
      return nil if link.nil?

      relative = URI(link.to_s.gsub(/#[a-zA-Z0-9_-]*$/,''))
      absolute = @url.merge(relative)

      absolute.path = '/' if absolute.path.empty?

      return absolute
    end

That get's rid of the extra encode call.

Reported by Ben VandenBos · June 25th, 2010 @ 01:59 PM

State: open
Milestone: 0.4.1
Assigned to: chris (at chriskite) chris (at chriskite)

Activity

  1. chris (at chriskite)
    chris (at chriskite)
    • Assigned user set to chris (at chriskite)
    • State changed from new to open
    • Milestone set to 0.4.1
    • Milestone order changed from 0 to 0

    July 30th, 2010 @ 07:36 PM

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.