Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do not fetch the same link twice

If a page lists a link more than once, or links to itself, don't fetch
more than once.
  • Loading branch information...
commit f68bca1baf6d19249e179357591a9b0d7a23ff76 1 parent 782f612
@singpolyma authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/relparser.rb
View
3  lib/relparser.rb
@@ -11,6 +11,7 @@ def initialize(opts={})
# Normalize
@meURI.scheme = "http" if @meURI.scheme == "https"
@meURI.path = "/" if @meURI.path == ""
+ @meURI.normalize!
end
def agent
@@ -40,7 +41,7 @@ def get(tag)
@page.links.each do |link|
links << link.href if link.rel?("me")
end
- links
+ links.map {|u| URI::parse(u).normalize}.uniq.reject {|u| u == @meURI}.map(&:to_s)
end
def rel_me_links
Please sign in to comment.
Something went wrong with that request. Please try again.