Default to nofollow if URI parse fails

This commit is contained in:
Carl Chenet 2017-05-20 15:33:17 +02:00
parent 31b9ec672f
commit 0fccf79089

View file

@ -27,7 +27,7 @@ class Markdowner
# make links have rel=nofollow
ng.css("a").each do |h|
h[:rel] = "nofollow" unless URI.parse(h[:href]).host.nil?
h[:rel] = "nofollow" unless (URI.parse(h[:href]).host.nil? rescue false)
end
ng.at_css("body").inner_html