FIX: Local onebox on subfolder installs

This should fix oneboxing local topics when using the subfolder install feature.
This commit is contained in:
Rafael dos Santos Silva 2016-02-01 13:30:48 -02:00
parent 49d1f88f6e
commit e51293d298

View file

@ -14,7 +14,7 @@ module Onebox
if other.kind_of?(URI)
uri = other
begin
route = Rails.application.routes.recognize_path(uri.path)
route = Rails.application.routes.recognize_path(uri.path.sub(Discourse.base_uri, ""))
case route[:controller]
when 'uploads'
super
@ -34,7 +34,7 @@ module Onebox
def to_html
uri = URI::parse(@url)
route = Rails.application.routes.recognize_path(uri.path)
route = Rails.application.routes.recognize_path(uri.path.sub(Discourse.base_uri, ""))
url = @url.sub(/[&?]source_topic_id=(\d+)/, "")
source_topic_id = $1.to_i