diff --git a/lib/onebox/engine/discourse_local_onebox.rb b/lib/onebox/engine/discourse_local_onebox.rb index 7857f55556b..d8bf15376e5 100644 --- a/lib/onebox/engine/discourse_local_onebox.rb +++ b/lib/onebox/engine/discourse_local_onebox.rb @@ -10,6 +10,25 @@ module Onebox 1 end + def self.===(other) + if other.kind_of?(URI) + uri = other + begin + route = Rails.application.routes.recognize_path(uri.path) + case route[:controller] + when 'topics' + true + else + false + end + rescue ActionController::RoutingError + false + end + else + super + end + end + def to_html uri = URI::parse(@url) route = Rails.application.routes.recognize_path(uri.path)