This commit is contained in:
karel.picman@lbcfree.net 2020-08-11 15:47:27 +02:00
parent aafe725306
commit e61671d61f
2 changed files with 5 additions and 6 deletions

View File

@ -120,6 +120,7 @@ module RedmineDmsf
i = 1
project_names = Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names']
while true
prj = nil
pinfo = @path.split('/').drop(i)
if pinfo.length > 0
if project_names
@ -137,7 +138,6 @@ module RedmineDmsf
break unless prj
i = i + 1
@project = prj
prj = nil
end
end
@project
@ -148,6 +148,7 @@ module RedmineDmsf
i = 1
project_names = Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names']
while true
prj = nil
pinfo = @path.split('/').drop(i)
if pinfo.length > 0
if project_names
@ -164,9 +165,7 @@ module RedmineDmsf
end
return '/' + @path.split('/').drop(i).join('/') unless prj
i = i + 1
prj = nil
end
puts ">>> Error: #{@path}"
end
def path_prefix

View File

@ -94,7 +94,7 @@ module RedmineDmsf
def folder
unless @folder
@folder = DmsfFolder.visible.where(project_id: project.id, title: basename,
dmsf_folder_id: parent.folder ? parent.folder.id : nil).first if project
dmsf_folder_id: parent&.folder&.id).first if project
end
@folder
end
@ -102,7 +102,7 @@ module RedmineDmsf
# Check if the current entity exists as a file (DmsfFile), and returns corresponding object if found (nil otherwise)
def file
unless @file
@file = DmsfFile.find_file_by_name(project, parent.folder, basename) if project
@file = DmsfFile.find_file_by_name(project, parent&.folder, basename) if project
end
@file
end
@ -111,7 +111,7 @@ module RedmineDmsf
unless @subproject
if Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names']
if basename =~ / (\d+)$/
@subproject = Project.visible.where(id: $1, parent_id: parent_project.id).first
@subproject = Project.visible.where(id: $1, parent_id: parent_project&.id).first
if @subproject
# Check again whether it's really the project and not a folder with a number as a suffix
@subproject = nil unless basename =~ /^#{@subproject.name}/