This commit is contained in:
karel.picman@lbcfree.net 2020-08-11 12:59:44 +02:00
parent f8784de9f8
commit ff786f9d7e

View File

@ -34,6 +34,7 @@ module RedmineDmsf
def initialize(path, request, response, options) def initialize(path, request, response, options)
raise NotFound if Setting.plugin_redmine_dmsf['dmsf_webdav'].blank? raise NotFound if Setting.plugin_redmine_dmsf['dmsf_webdav'].blank?
@project = nil @project = nil
@projectless_path = nil
@public_path = "#{options[:root_uri_path]}#{path}" @public_path = "#{options[:root_uri_path]}#{path}"
@children = nil @children = nil
super path, request, response, options super path, request, response, options
@ -119,7 +120,7 @@ module RedmineDmsf
unless @project unless @project
i = 1 i = 1
project_names = Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] project_names = Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names']
puts ">>> path: #{@path}" puts ">>> path: #{@path} - #{project_names}"
while true while true
pinfo = @path.split('/').drop(i) pinfo = @path.split('/').drop(i)
puts ">>> pinfo: #{pinfo} - #{i}" puts ">>> pinfo: #{pinfo} - #{i}"
@ -129,7 +130,7 @@ module RedmineDmsf
prj = Project.visible.find_by(id: $1) prj = Project.visible.find_by(id: $1)
if prj if prj
# Check again whether it's really the project and not a folder with a number as a suffix # Check again whether it's really the project and not a folder with a number as a suffix
prj = nil unless pinfo.first =~ /^#{prj.name}/ prj = nil unless pinfo.first =~ /^#{prj.name}/
end end
end end
else else
@ -145,8 +146,8 @@ module RedmineDmsf
end end
end end
unless prj unless prj
@projectless_path = '/' + @path.split('/').drop(i).join('/') @projectless_path = '/' + @path.split('/').drop(i + 1).join('/')
puts ">>> less_path: #{@path.split('/').drop(i)} - #{i}" puts ">>> less_path: #{@projectless_path} - #{i}"
break break
end end
i = i + 1 i = i + 1