Fixes #21 Webdav seems to be functional from subfolder

This commit is contained in:
Daniel Munn 2012-07-05 13:12:56 +01:00
parent 5dee0c03e2
commit e8afc9f584
2 changed files with 5 additions and 1 deletions

View File

@ -132,6 +132,10 @@ table { width:100%%; }
def projectless_path
'/'+path.split('/').drop(2).join('/')
end
def path_prefix
public_path.gsub(/#{Regexp.escape(path)}$/, '')
end
end
end
end

View File

@ -601,7 +601,7 @@ module RedmineDmsf
end
lock_entity = lock.folder || lock.file
lock_path = "#{request.scheme}://#{request.host}:#{request.port}/dmsf/webdav/#{URI.escape(lock_entity.project.identifier)}/"
lock_path = "#{request.scheme}://#{request.host}:#{request.port}#{path_prefix}#{URI.escape(lock_entity.project.identifier)}/"
lock_path << lock_entity.dmsf_path.map {|x| URI.escape(x.respond_to?('name') ? x.name : x.title) }.join('/')
lock_path << "/" if lock_entity.is_a?(DmsfFolder) && lock_path[-1,1] != '/'
doc.lockroot { doc.href lock_path }