FIX: detect local assets for subfolder installs

FIX: detect local assets for subfolder installs

diff --git a/lib/url_helper.rb b/lib/url_helper.rb
index 51e9378..0756a0b 100644
--- a/lib/url_helper.rb
+++ b/lib/url_helper.rb
@@ -18,7 +18,7 @@ class UrlHelper
   def self.is_local(url)
     url.present? && (
       Discourse.store.has_been_uploaded?(url) ||
-      !!(url =~ /^\/(assets|plugins|images)\//) ||
+      !!(url =~ Regexp.new("^#{Discourse.base_uri}/(assets|plugins|images)/")) ||
       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 0ca6596..ba7bc71 100644
--- a/spec/components/url_helper_spec.rb
+++ b/spec/components/url_helper_spec.rb
@@ -28,6 +28,14 @@ describe UrlHelper do
       expect(UrlHelper.is_local("/assets/javascripts/all.js")).to eq(true)
     end
 
+    it "is true for relative assets for subfolders" do
+      store = stub
+      store.expects(:has_been_uploaded?).returns(false)
+      Discourse.stubs(:store).returns(store)
+      Discourse.stubs(:base_uri).returns("/subpath")
+      expect(UrlHelper.is_local("/subpath/assets/javascripts/all.js")).to eq(true)
+    end
+
     it "is true for plugin assets" do
       store = stub
       store.expects(:has_been_uploaded?).returns(false)

GitHub sha: 2863abef