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"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# 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
# modify it under the terms of the GNU General Public License
@ -113,8 +115,9 @@ RedmineApp::Application.routes.draw do
mount DAV4Rack::Handler.new(
:root_uri_path => "#{Redmine::Utils::relative_url_root}/dmsf/webdav",
:resource_class => RedmineDmsf::Webdav::ResourceProxy,
:controller_class => RedmineDmsf::Webdav::Controller
), :at => "/dmsf/webdav"
:controller_class => RedmineDmsf::Webdav::Controller,
:log_to => Rails.logger
), :at => '/dmsf/webdav'
# Approval workflow
resources :dmsf_workflows do

View File

@ -118,7 +118,7 @@ module RedmineDmsf
# Escape URL string
def url_format(resource)
# 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, '[]')
end

View File

@ -1,6 +1,9 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# 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
# modify it under the terms of the GNU General Public License
@ -24,21 +27,15 @@ module RedmineDmsf
end
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
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'
end
end
@app.call(env)
end
private
def logger(env)
env['action_dispatch.logger'] || Logger.new($stdout)
end
end
end