WebDAV logging enabled

This commit is contained in:
Karel Picman 2016-03-02 08:42:39 +01:00
parent 0f1eccffd7
commit a8e8e1b3e5
3 changed files with 15 additions and 15 deletions

View File

@ -1,8 +1,10 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com> # Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk> # Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com> # Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -113,8 +115,9 @@ RedmineApp::Application.routes.draw do
mount DAV4Rack::Handler.new( mount DAV4Rack::Handler.new(
:root_uri_path => "#{Redmine::Utils::relative_url_root}/dmsf/webdav", :root_uri_path => "#{Redmine::Utils::relative_url_root}/dmsf/webdav",
:resource_class => RedmineDmsf::Webdav::ResourceProxy, :resource_class => RedmineDmsf::Webdav::ResourceProxy,
:controller_class => RedmineDmsf::Webdav::Controller :controller_class => RedmineDmsf::Webdav::Controller,
), :at => "/dmsf/webdav" :log_to => Rails.logger
), :at => '/dmsf/webdav'
# Approval workflow # Approval workflow
resources :dmsf_workflows do resources :dmsf_workflows do
@ -141,4 +144,4 @@ RedmineApp::Application.routes.draw do
end end
end end
end end

View File

@ -118,7 +118,7 @@ module RedmineDmsf
# Escape URL string # Escape URL string
def url_format(resource) def url_format(resource)
# Additionally escape square brackets, otherwise files with # Additionally escape square brackets, otherwise files with
# file name like file[1].pdf are not visible in some WebDAV clients # file names like file[1].pdf are not visible in some WebDAV clients
URI.encode(super, '[]') URI.encode(super, '[]')
end end

View File

@ -1,6 +1,9 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features" # Redmine plugin for Document Management System "Features"
# #
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk> # Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-16 Karel Pičman <karel.picman@kontron.com>
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -24,21 +27,15 @@ module RedmineDmsf
end end
def call(env) def call(env)
if env['REQUEST_METHOD'] == "PUT" && env.has_key?('CONTENT_TYPE') then if env['REQUEST_METHOD'] == 'PUT' && env.has_key?('CONTENT_TYPE') then
if (@urls.dup.delete_if {|x| !env['PATH_INFO'].starts_with? x}.length > 0) then if (@urls.dup.delete_if {|x| !env['PATH_INFO'].starts_with? x}.length > 0) then
logger "RedmineDmsf::NoParse prevented mime parsing for PUT #{env['PATH_INFO']}" Rails.logger.info "RedmineDmsf::NoParse prevented mime parsing for PUT #{env['PATH_INFO']}"
env['CONTENT_TYPE'] = 'text/plain' env['CONTENT_TYPE'] = 'text/plain'
end end
end end
@app.call(env) @app.call(env)
end end
private
def logger(env)
env['action_dispatch.logger'] || Logger.new($stdout)
end
end end
end end