Project

General

Profile

Feature #26709 » application_controller.rb.patch

ActionController::UnknownFormat & CSRF - Pavel Rosický, 2017-08-17 01:26

View differences:

application_controller.rb (working copy)
rescue_from ::Unauthorized, :with => :deny_access
rescue_from ::ActionView::MissingTemplate, :with => :missing_template
rescue_from ::ActionController::UnknownFormat, :with => :unknown_format
rescue_from ::ActionController::InvalidCrossOriginRequest, :with => :csrf_error
include Redmine::Search::Controller
include Redmine::MenuManager::MenuController
......
render_404
end
def unknown_format(exception)
if Rails.application.config.consider_all_requests_local
raise exception
else
head 406
end
end
def csrf_error(exception)
if Rails.application.config.consider_all_requests_local
raise exception
else
self.response_body = nil
head 400
end
end
# Filter for actions that provide an API response
# but have no HTML representation for non admin users
def require_admin_or_api_request
(2-2/3)