diff --git a/lib/redmine_dmsf/webdav/custom_middleware.rb b/lib/redmine_dmsf/webdav/custom_middleware.rb index 9fdd4883..c485d31e 100644 --- a/lib/redmine_dmsf/webdav/custom_middleware.rb +++ b/lib/redmine_dmsf/webdav/custom_middleware.rb @@ -33,7 +33,8 @@ module RedmineDmsf run Dav4rack::Handler.new( root_uri_path: path, resource_class: RedmineDmsf::Webdav::ResourceProxy, - allow_unauthenticated_options_on_root: true + allow_unauthenticated_options_on_root: true, + controller_class: DmsfController ) end end diff --git a/lib/redmine_dmsf/webdav/dmsf_controller.rb b/lib/redmine_dmsf/webdav/dmsf_controller.rb new file mode 100644 index 00000000..7a209538 --- /dev/null +++ b/lib/redmine_dmsf/webdav/dmsf_controller.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Redmine plugin for Document Management System "Features" +# +# Copyright © 2012 Daniel Munn +# Copyright © 2011-23 Karel Pičman +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module RedmineDmsf + module Webdav + class DmsfController < Dav4rack::Controller + include Redmine::I18n + include AbstractController::Callbacks + + around_action :switch_locale + + def switch_locale(&action) + # Switch the locale to English for WebDAV requests in order to have log messages in English + I18n.with_locale(:en, &action) + end + end + end +end