FIX: Multiple links being generated for non-theme targets.

FIX: Multiple links being generated for non-theme targets.

Follow-up to 8e3691d5370bb95d99fe750f46287763721fcc9c

diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rb
index c433f90..3ce2c06 100644
--- a/lib/stylesheet/manager.rb
+++ b/lib/stylesheet/manager.rb
@@ -201,8 +201,9 @@ class Stylesheet::Manager
     @@lock.synchronize do
       stylesheets = []
       stale_theme_ids = []
+      theme_ids = target.to_s =~ THEME_REGEX ? @theme_ids : [@theme_id]
 
-      @theme_ids.each do |theme_id|
+      theme_ids.each do |theme_id|
         cache_key = "path_#{target}_#{theme_id}_#{current_hostname}"
 
         if href = cache[cache_key]
diff --git a/spec/components/stylesheet/manager_spec.rb b/spec/components/stylesheet/manager_spec.rb
index 7efb508..a4b083a 100644
--- a/spec/components/stylesheet/manager_spec.rb
+++ b/spec/components/stylesheet/manager_spec.rb
@@ -38,6 +38,14 @@ describe Stylesheet::Manager do
       t.add_relative_theme!(:child, child_theme)
     }}
 
+    it "generates the right links for non-theme targets" do
+      manager = manager(theme.id)
+
+      hrefs = manager.stylesheet_details(:desktop, 'all')
+
+      expect(hrefs.length).to eq(1)
+    end
+
     it 'can correctly compile theme css' do
       manager = manager(theme.id)
       old_links = manager.stylesheet_link_tag(:desktop_theme, 'all')

GitHub sha: 7901f735979c9cf26604be8084c6cf9850049987

This commit appears in #13457 which was approved by jjaffeux. It was merged by tgxworld.