From 4c3b5464295ca0b7e45f44f9af6d2d5d7a2c208a Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Mon, 14 Apr 2014 13:59:39 +0200 Subject: [PATCH] #246 'File storage directory' does not default properly when setting is empty --- app/models/dmsf_file.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index b538dd68..8d591f05 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -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