#716 dav4rack -> planio/dav4rack
This commit is contained in:
parent
cabcf78800
commit
43077c2851
@ -272,15 +272,6 @@
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= content_tag(:label, l(:label_caching_enabled)) %>
|
||||
<%= check_box_tag('settings[dmsf_webdav_caching_enabled]', false, @settings['dmsf_webdav_caching_enabled']) %>
|
||||
<em class="info">
|
||||
<%= l(:note_webdav_cahing_enabled) %> <br/>
|
||||
<%= l(:label_default)%>: <%= l(:general_text_No)%>
|
||||
</em>
|
||||
</p>
|
||||
|
||||
<hr/>
|
||||
<em class="info">
|
||||
<%= l(:label_full_text) %>
|
||||
|
||||
@ -30,7 +30,6 @@ module RedmineDmsf
|
||||
attr_reader :public_path
|
||||
|
||||
def initialize(path, request, response, options)
|
||||
raise NotFound unless Setting.plugin_redmine_dmsf['dmsf_webdav'].present?
|
||||
@project = nil
|
||||
@public_path = "#{options[:root_uri_path]}#{path}"
|
||||
super(path, request, response, options)
|
||||
|
||||
@ -40,21 +40,26 @@ module RedmineDmsf
|
||||
end
|
||||
|
||||
def call(env)
|
||||
status, headers, body = @dav_app.call env
|
||||
# If the URL map generated by Rack::Builder did not find a matching path,
|
||||
# it will return a 404 along with the X-Cascade header set to 'pass'.
|
||||
if status == 404 and headers['X-Cascade'] == 'pass'
|
||||
# The MS web redirector webdav client likes to go up a level and try
|
||||
# OPTIONS there. We catch that here and respond telling it that just
|
||||
# plain HTTP is going on.
|
||||
if 'OPTIONS'.casecmp(env['REQUEST_METHOD'].to_s) == 0
|
||||
[ '200', { 'Allow' => 'OPTIONS,HEAD,GET,PUT,POST,DELETE' }, [''] ]
|
||||
begin
|
||||
status, headers, body = @dav_app.call env
|
||||
# If the URL map generated by Rack::Builder did not find a matching path,
|
||||
# it will return a 404 along with the X-Cascade header set to 'pass'.
|
||||
if status == 404 and headers['X-Cascade'] == 'pass'
|
||||
# The MS web redirector webdav client likes to go up a level and try
|
||||
# OPTIONS there. We catch that here and respond telling it that just
|
||||
# plain HTTP is going on.
|
||||
if 'OPTIONS'.casecmp(env['REQUEST_METHOD'].to_s) == 0
|
||||
[ '200', { 'Allow' => 'OPTIONS,HEAD,GET,PUT,POST,DELETE' }, [''] ]
|
||||
else
|
||||
# let Rails handle the request
|
||||
@rails_app.call env
|
||||
end
|
||||
else
|
||||
# let Rails handle the request
|
||||
@rails_app.call env
|
||||
[status, headers, body]
|
||||
end
|
||||
else
|
||||
[status, headers, body]
|
||||
rescue Exception => e
|
||||
# let Rails handle the request
|
||||
@rails_app.call env
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -34,6 +34,8 @@ module RedmineDmsf
|
||||
attr_reader :read_only
|
||||
|
||||
def initialize(*args)
|
||||
# Return 404 - NotFound if WebDAV is not enabled
|
||||
raise NotFound unless Setting.plugin_redmine_dmsf['dmsf_webdav'].present?
|
||||
super(*args)
|
||||
pinfo = path.split('/').drop(1)
|
||||
if (pinfo.length == 0) # If this is the base_path, we're at root
|
||||
|
||||
@ -36,4 +36,10 @@ class DmsfWebdavCustomMiddlewareTest < RedmineDmsf::Test::IntegrationTest
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_webdav_not_enabled
|
||||
Setting.plugin_redmine_dmsf['dmsf_webdav'] = nil
|
||||
xml_http_request :options, '/dmsf/webdav'
|
||||
assert_response 404
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user