From acd81c3dd912546b47f1db9ad4682c9fb63b1a5e Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Tue, 13 Mar 2018 13:21:54 +0100 Subject: [PATCH] Db rollback fix --- app/models/dmsf_file.rb | 2 +- app/models/dmsf_file_revision.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index e2d6d0d3..dc6ed549 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -97,7 +97,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'].try(:strip) if path.blank? path = Pathname.new('files').join('dmsf').to_s else diff --git a/app/models/dmsf_file_revision.rb b/app/models/dmsf_file_revision.rb index 98dfc13b..85f6fb92 100644 --- a/app/models/dmsf_file_revision.rb +++ b/app/models/dmsf_file_revision.rb @@ -142,7 +142,11 @@ class DmsfFileRevision < ActiveRecord::Base 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 StandardError => e + Rails.logger.error e.message + end filename = path.join(self.disk_filename) if search_if_not_exists unless File.exist?(filename)