FIX: Could not download exported data on some sites

This commit is contained in:
Robin Ward
2014-11-20 14:01:48 -05:00
parent b8d806ee07
commit dd1ebb535b
2 changed files with 27 additions and 0 deletions

View File

@@ -31,6 +31,12 @@ class TopicLinkClick < ActiveRecord::Base
unless link.present?
return args[:url] if args[:url] =~ /^\//
begin
uri = URI.parse(args[:url])
return args[:url] if uri.host == URI.parse(Discourse.base_url).host
rescue
end
# If we have it somewhere else on the site, just allow the redirect. This is
# likely due to a onebox of another topic.
link = TopicLink.find_by(url: args[:url])