Permission denied @ dir_s_mkdir

This commit is contained in:
Karel Picman 2018-03-06 12:48:33 +01:00
parent e5f3c30a82
commit e5bb2d30b6
2 changed files with 7 additions and 4 deletions

View File

@ -96,7 +96,7 @@ class DmsfFile < ActiveRecord::Base
end
def self.storage_path
path = Setting.plugin_redmine_dmsf['dmsf_storage_directory']
path = Setting.plugin_redmine_dmsf['dmsf_storage_directory'].strip
if path.blank?
path = Pathname.new('files').join('dmsf')
else

View File

@ -153,13 +153,16 @@ class DmsfFileRevision < ActiveRecord::Base
def storage_base_path
time = self.created_at || DateTime.now
path = time.strftime('%Y/%m')
DmsfFile.storage_path.join path
DmsfFile.storage_path.join(time.strftime('%Y')).join(time.strftime('%m'))
end
def disk_file(search_if_not_exists = true)
path = self.storage_base_path
FileUtils.mkdir_p(path) unless File.exist?(path)
begin
FileUtils.mkdir_p(path) unless File.exist?(path)
rescue Exception => e
Rails.logger.error e.message
end
filename = path.join(self.disk_filename)
if search_if_not_exists
unless File.exist?(filename)