From 894bb0716c0ae3a8bf0e4731096111c8610143e8 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 7 Mar 2014 19:16:32 +1100 Subject: [PATCH] BUGFIX: if uploads is in a symlinked directory stuff breaks --- app/models/site_customization.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/models/site_customization.rb b/app/models/site_customization.rb index f46ea5e592a..6c8aef0619f 100644 --- a/app/models/site_customization.rb +++ b/app/models/site_customization.rb @@ -153,7 +153,14 @@ class SiteCustomization < ActiveRecord::Base [[:desktop, 'stylesheet_baked'], [:mobile, 'mobile_stylesheet_baked']].each do |target, baked_attr| path = stylesheet_fullpath(target) dir = cache_fullpath - FileUtils.mkdir_p(dir) + + begin + FileUtils.mkdir_p(dir) + rescue + # subtle issue, this happens if "uploads" is a symlink + Errno::EEXIST + end + unless File.exists?(path) File.open(path, "w") do |f| f.puts self.send(baked_attr)