#246 'File storage directory' does not default properly when setting is empty

This commit is contained in:
Karel Picman 2014-04-14 13:59:39 +02:00
parent 20f74ebf64
commit 4c3b546429

View File

@ -71,8 +71,11 @@ class DmsfFile < ActiveRecord::Base
@@storage_path = nil
def self.storage_path
self.storage_path = Setting.plugin_redmine_dmsf['dmsf_storage_directory'].strip unless @@storage_path
Dir.mkdir(@@storage_path) unless File.exists?(@@storage_path)
unless @@storage_path.present?
@@storage_path = Setting.plugin_redmine_dmsf['dmsf_storage_directory'].strip
@@storage_path = Rails.root.join('files/dmsf').to_s if @@storage_path.blank?
Dir.mkdir(@@storage_path) unless File.exists?(@@storage_path)
end
@@storage_path
end