FIX: no-follow not handled correctly for sub domains

if a.com was whitelisted aa.com would pass through
This commit is contained in:
Sam
2015-05-27 14:31:01 +10:00
parent 693b5234da
commit 93ab03966e
2 changed files with 11 additions and 2 deletions

View File

@ -242,8 +242,9 @@ module PrettyText
site_uri ||= URI(Discourse.base_url)
if !uri.host.present? ||
uri.host.ends_with?(site_uri.host) ||
whitelist.any?{|u| uri.host.ends_with?(u)}
uri.host == site_uri.host ||
uri.host.ends_with?("." << site_uri.host) ||
whitelist.any?{|u| uri.host == u || uri.host.ends_with?("." << u)}
# we are good no need for nofollow
else
l["rel"] = "nofollow"