From 39f3a92e46bb52410172808b34840e18cefaa012 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Mon, 2 May 2016 10:31:43 +0200 Subject: [PATCH] NoParse class removed --- config/routes.rb | 3 +- lib/redmine_dmsf.rb | 1 - lib/redmine_dmsf/webdav/no_parse.rb | 48 ----------------------------- 3 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 lib/redmine_dmsf/webdav/no_parse.rb diff --git a/config/routes.rb b/config/routes.rb index d1d962a7..8f86500c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -110,8 +110,7 @@ RedmineApp::Application.routes.draw do get '/dmsf/folders/:id/copy', :controller => 'dmsf_folders_copy', :action => 'new', :as => 'copy_folder' # - # DAV4Rack implementation of Webdav [note: if changing path you'll need to update lib/redmine_dmsf/webdav/no_parse.rb also] - # /dmsf/webdav + # DAV4Rack implementation of Webdav mount DAV4Rack::Handler.new( :root_uri_path => "#{Redmine::Utils::relative_url_root}/dmsf/webdav", :resource_class => RedmineDmsf::Webdav::ResourceProxy, diff --git a/lib/redmine_dmsf.rb b/lib/redmine_dmsf.rb index 96a378dc..5b9718b2 100644 --- a/lib/redmine_dmsf.rb +++ b/lib/redmine_dmsf.rb @@ -32,7 +32,6 @@ require 'redmine_dmsf/patches/project_tabs_extended' require 'redmine_dmsf/patches/user_preference_patch' # Load up classes that make up our WebDAV solution ontop of DAV4Rack -require 'redmine_dmsf/webdav/no_parse' require 'redmine_dmsf/webdav/base_resource' require 'redmine_dmsf/webdav/controller' require 'redmine_dmsf/webdav/dmsf_resource' diff --git a/lib/redmine_dmsf/webdav/no_parse.rb b/lib/redmine_dmsf/webdav/no_parse.rb deleted file mode 100644 index 4c1edf7a..00000000 --- a/lib/redmine_dmsf/webdav/no_parse.rb +++ /dev/null @@ -1,48 +0,0 @@ -# encoding: utf-8 -# -# Redmine plugin for Document Management System "Features" -# -# Copyright (C) 2012 Daniel Munn -# Copyright (C) 2011-16 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 - class NoParse - def initialize(app, options={}) - @app = app - @urls = options[:urls] - end - - def call(env) - 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 - Rails.logger.info "RedmineDmsf::NoParse prevented mime parsing for PUT #{env['PATH_INFO']}" - env['CONTENT_TYPE'] = 'text/plain' - end - end - @app.call(env) - end - - end -end - -# Todo: -# This should probably be configurable somehow or better have the module hunt for the correct pathing -# automatically without the need to add a "/dmsf/webdav" configuration to it, as if the route is changed -# the functonality of this patch will effectively break. -Rails.configuration.middleware.insert_before( - ActionDispatch::ParamsParser, - RedmineDmsf::NoParse, :urls => ["#{Redmine::Utils::relative_url_root}/dmsf/webdav"]) \ No newline at end of file