lib/content_link_parser.rb in cobweb-0.0.55 vs lib/content_link_parser.rb in cobweb-0.0.57
- old
+ new
@@ -44,9 +44,10 @@
def all_links(options = {})
options[:valid_schemes] = [:http, :https] unless options.has_key? :valid_schemes
data = link_data
links = data.keys.map{|key| data[key]}.flatten.uniq
links = links.map{|link| UriHelper.join_no_fragment(@url, link).to_s }
+ links = links.reject{|link| link =~ /\/([^\/]+?)\/\1\// }
links = links.reject{|link| link =~ /([^\/]+?)\/([^\/]+?)\/.*?\1\/\2/ }
links = links.select{|link| options[:valid_schemes].include? link.split(':')[0].to_sym}
links
end