diff --git a/lib/url_helper.rb b/lib/url_helper.rb index caf8e0b67db..425ec50a5f4 100644 --- a/lib/url_helper.rb +++ b/lib/url_helper.rb @@ -3,6 +3,7 @@ module UrlHelper def is_local(url) Discourse.store.has_been_uploaded?(url) || url =~ /^\/assets\// || + url =~ /^\/plugins\// || url.start_with?(Discourse.asset_host || Discourse.base_url_no_prefix) end diff --git a/spec/components/url_helper_spec.rb b/spec/components/url_helper_spec.rb index bc631ab02a0..5b282a31c6a 100644 --- a/spec/components/url_helper_spec.rb +++ b/spec/components/url_helper_spec.rb @@ -25,6 +25,13 @@ describe UrlHelper do helper.is_local("/assets/javascripts/all.js").should be_true end + it "is true for plugin assets" do + store = stub + store.expects(:has_been_uploaded?).returns(false) + Discourse.stubs(:store).returns(store) + helper.is_local("/plugins/all.js").should be_true + end + end describe "#absolute" do