A platform for community discussion. Free, open, simple.
FIX: `Stylesheet::Manager.stylesheet_link_tag` cache should account for `Discourse.current_hostname`.
Guo Xiang Tane5cec28eae42
diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rbindex 92442b56060..3055eb95689 100644--- a/lib/stylesheet/manager.rb+++ b/lib/stylesheet/manager.rb@@ -34,7 +34,8 @@ class Stylesheet::Managertheme_key = SiteSetting.default_theme_keyend- cache_key = "#{target}_#{theme_key}"+ current_hostname = Discourse.current_hostname+ cache_key = "#{target}_#{theme_key}_#{current_hostname}"tag = cache[cache_key]return tag.dup.html_safe if tag@@ -45,7 +46,7 @@ class Stylesheet::Managertag = ""elsebuilder.compile unless File.exists?(builder.stylesheet_fullpath)- tag = %[<link href="#{builder.stylesheet_path}" media="#{media}" rel="stylesheet" data-target="#{target}"/>]+ tag = %[<link href="#{builder.stylesheet_path(current_hostname)}" media="#{media}" rel="stylesheet" data-target="#{target}"/>]endcache[cache_key] = tag@@ -181,12 +182,12 @@ class Stylesheet::Manager"#{cache_fullpath}/#{stylesheet_filename_no_digest}"end- def stylesheet_cdnpath- "#{GlobalSetting.cdn_url}#{stylesheet_relpath}?__ws=#{Discourse.current_hostname}"+ def stylesheet_cdnpath(hostname)+ "#{GlobalSetting.cdn_url}#{stylesheet_relpath}?__ws=#{hostname}"end- def stylesheet_path- stylesheet_cdnpath+ def stylesheet_path(hostname)+ stylesheet_cdnpath(hostname)enddef root_path