Merge branch 'devel-2.4.5' of github.com:danmunn/redmine_dmsf into devel-2.4.5
This commit is contained in:
commit
c9fcfd12a0
@ -21,6 +21,7 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
require 'dav4rack'
|
||||
require 'addressable/uri'
|
||||
|
||||
module RedmineDmsf
|
||||
module Webdav
|
||||
@ -88,7 +89,7 @@ module RedmineDmsf
|
||||
Confict unless collection?
|
||||
entities = children.map{ |child|
|
||||
DIR_FILE % [
|
||||
"#{@options[:root_uri_path]}#{URI.encode(child.path)}",
|
||||
"#{@options[:root_uri_path]}#{Addressable::URI.encode(child.path)}",
|
||||
child.long_name || child.name,
|
||||
child.collection? ? '' : number_to_human_size(child.content_length),
|
||||
child.special_type || child.content_type,
|
||||
@ -96,7 +97,7 @@ module RedmineDmsf
|
||||
]
|
||||
} * "\n"
|
||||
entities = DIR_FILE % [
|
||||
URI.encode(parent.public_path),
|
||||
Addressable::URI.encode(parent.public_path),
|
||||
l(:parent_directory),
|
||||
'',
|
||||
'',
|
||||
|
||||
@ -200,6 +200,7 @@ module RedmineDmsf
|
||||
if collection?
|
||||
html_display
|
||||
response['Content-Length'] = response.body.bytesize.to_s
|
||||
response['Content-Type'] = 'text/html'
|
||||
else
|
||||
raise Forbidden unless User.current.admin? || User.current.allowed_to?(:view_dmsf_files, project)
|
||||
response.body = download # Rack based provider
|
||||
|
||||
@ -68,6 +68,7 @@ module RedmineDmsf
|
||||
def get(request, response)
|
||||
html_display
|
||||
response['Content-Length'] = response.body.bytesize.to_s
|
||||
response['Content-Type'] = 'text/html'
|
||||
OK
|
||||
end
|
||||
|
||||
|
||||
@ -97,6 +97,7 @@ module RedmineDmsf
|
||||
def get(request, response)
|
||||
html_display
|
||||
response['Content-Length'] = response.body.bytesize.to_s
|
||||
response['Content-Type'] = 'text/html'
|
||||
OK
|
||||
end
|
||||
|
||||
|
||||
@ -41,13 +41,20 @@ class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_should_include_response_headers
|
||||
get '/dmsf/webdav', params: nil, headers: @admin
|
||||
assert_response :success
|
||||
assert_equal 'text/html', response.headers['Content-Type']
|
||||
assert response.headers['Content-Length'].to_i > 0, "Content-Length should be > 0, but was #{response.headers['Content-Length']}"
|
||||
end
|
||||
|
||||
def test_should_list_dmsf_enabled_project
|
||||
get '/dmsf/webdav', params: nil, headers: @admin
|
||||
assert_response :success
|
||||
assert !response.body.match(@project1.identifier).nil?,
|
||||
"Expected to find project #{@project1.identifier} in return data"
|
||||
Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = true
|
||||
project1_uri = URI.encode(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1))
|
||||
project1_uri = Addressable::URI.encode(RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1))
|
||||
get '/dmsf/webdav', params: nil, headers: @admin
|
||||
assert_response :success
|
||||
assert_no_match @project1.identifier, response.body
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user