#1136 CI
This commit is contained in:
parent
afc81717d1
commit
f8784de9f8
@ -119,8 +119,10 @@ module RedmineDmsf
|
||||
unless @project
|
||||
i = 1
|
||||
project_names = Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names']
|
||||
puts ">>> path: #{@path}"
|
||||
while true
|
||||
pinfo = @path.split('/').drop(i)
|
||||
puts ">>> pinfo: #{pinfo} - #{i}"
|
||||
if pinfo.length > 0
|
||||
if project_names
|
||||
if pinfo.first =~ / (\d+)$/
|
||||
@ -132,9 +134,11 @@ module RedmineDmsf
|
||||
end
|
||||
else
|
||||
begin
|
||||
puts ">>> pinfo.first: #{pinfo.first}"
|
||||
scope = Project.visible.where(identifier: pinfo.first)
|
||||
scope = scope.where(parent_id: @project.id) if @project
|
||||
prj = scope.first
|
||||
puts ">>> prj: #{prj.identifier}" if prj
|
||||
rescue => e
|
||||
Rails.logger.error e.message
|
||||
end
|
||||
@ -142,6 +146,7 @@ module RedmineDmsf
|
||||
end
|
||||
unless prj
|
||||
@projectless_path = '/' + @path.split('/').drop(i).join('/')
|
||||
puts ">>> less_path: #{@path.split('/').drop(i)} - #{i}"
|
||||
break
|
||||
end
|
||||
i = i + 1
|
||||
@ -154,7 +159,8 @@ module RedmineDmsf
|
||||
|
||||
# Make it easy to find the path without project in it.
|
||||
def projectless_path
|
||||
project # Initialization
|
||||
puts ">>> projectless_path ###"
|
||||
self.project # Initialization
|
||||
@projectless_path
|
||||
end
|
||||
|
||||
|
||||
@ -452,20 +452,14 @@ module RedmineDmsf
|
||||
|
||||
# Lock
|
||||
def lock(args)
|
||||
puts ">>> #{parent}"
|
||||
puts ">>> #{parent.projectless_path}"
|
||||
puts ">>> #{parent_exists?}"
|
||||
puts ">>> #{@path}"
|
||||
if parent.nil? || ((parent.projectless_path != '/') && (!parent.exists?))
|
||||
e = DAV4Rack::LockFailure.new
|
||||
e.add_failure @path, Conflict
|
||||
puts ">>> #{parent.projectless_path}, #{parent&.exists?}"
|
||||
raise e
|
||||
end
|
||||
unless exist?
|
||||
e = DAV4Rack::LockFailure.new
|
||||
e.add_failure @path, NotFound
|
||||
puts ">>> exist? false"
|
||||
raise e
|
||||
end
|
||||
lock_check(args[:scope])
|
||||
@ -473,7 +467,6 @@ module RedmineDmsf
|
||||
unless entity
|
||||
e = DAV4Rack::LockFailure.new
|
||||
e.add_failure @path, MethodNotAllowed
|
||||
puts ">>> entity nil"
|
||||
raise e
|
||||
end
|
||||
begin
|
||||
@ -490,7 +483,6 @@ module RedmineDmsf
|
||||
if http_if.blank?
|
||||
e = DAV4Rack::LockFailure.new
|
||||
e.add_failure @path, Conflict
|
||||
puts ">>> http_if blank"
|
||||
raise e
|
||||
end
|
||||
l = nil
|
||||
@ -500,7 +492,6 @@ module RedmineDmsf
|
||||
unless l
|
||||
e = DAV4Rack::LockFailure.new
|
||||
e.add_failure @path, Conflict
|
||||
puts ">>> lock not found"
|
||||
raise e
|
||||
end
|
||||
l.expires_at = Time.current + 1.week
|
||||
@ -520,7 +511,6 @@ module RedmineDmsf
|
||||
rescue DmsfLockError
|
||||
e = DAV4Rack::LockFailure.new
|
||||
e.add_failure @path, Conflict
|
||||
puts ">>> DmsfLockError"
|
||||
raise e
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user