From e5cec28eae428244f2cfcf2d5aa33e1f7182c247 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Tue, 20 Feb 2018 09:52:20 +0800 Subject: [PATCH] FIX: `Stylesheet::Manager.stylesheet_link_tag` cache should account for `Discourse.current_hostname`. --- lib/stylesheet/manager.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rb index 92442b56060..3055eb95689 100644 --- a/lib/stylesheet/manager.rb +++ b/lib/stylesheet/manager.rb @@ -34,7 +34,8 @@ class Stylesheet::Manager theme_key = SiteSetting.default_theme_key end - 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::Manager tag = "" else builder.compile unless File.exists?(builder.stylesheet_fullpath) - tag = %[] + tag = %[] end cache[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) end def root_path