summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-05-28 03:58:01 +0000
committerGo MAEDA <maeda@farend.jp>2021-05-28 03:58:01 +0000
commit66fc9f463dbca69529df106338cafcc46f5fa115 (patch)
tree888a9a4b8765e62e85bce9a8f244902547607b12 /app/controllers
parent7b2fdc771b6858f646ac16b93266392c0a945531 (diff)
downloadredmine-66fc9f463dbca69529df106338cafcc46f5fa115.tar.gz
redmine-66fc9f463dbca69529df106338cafcc46f5fa115.zip
Gracefully handle invalid query parameters for custom fields (#35312).
Patch by Holger Just. git-svn-id: http://svn.redmine.org/redmine/trunk@21012 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/application_controller.rb7
-rw-r--r--app/controllers/issues_controller.rb6
-rw-r--r--app/controllers/timelog_controller.rb6
3 files changed, 19 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b5644e89d..f907b1159 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -725,6 +725,13 @@ class ApplicationController < ActionController::Base
render_error l(:error_query_statement_invalid)
end
+ def query_error(exception)
+ Rails.logger.debug "#{exception.class.name}: #{exception.message}"
+ Rails.logger.debug " #{exception.backtrace.join("\n ")}"
+
+ render_404
+ end
+
# Renders a 204 response for successful updates or deletions via the API
def render_api_ok
render_api_head :no_content
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 887bcd4bb..0278b3088 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -29,6 +29,7 @@ class IssuesController < ApplicationController
accept_api_auth :index, :show, :create, :update, :destroy
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
+ rescue_from Query::QueryError, :with => :query_error
helper :journals
helper :projects
@@ -470,6 +471,11 @@ class IssuesController < ApplicationController
private
+ def query_error(exception)
+ session.delete(:issue_query)
+ super
+ end
+
def retrieve_previous_and_next_issue_ids
if params[:prev_issue_id].present? || params[:next_issue_id].present?
@prev_issue_id = params[:prev_issue_id].presence.try(:to_i)
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb
index 1b63f3cec..3ccab48e5 100644
--- a/app/controllers/timelog_controller.rb
+++ b/app/controllers/timelog_controller.rb
@@ -32,6 +32,7 @@ class TimelogController < ApplicationController
accept_api_auth :index, :show, :create, :update, :destroy
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
+ rescue_from Query::QueryError, :with => :query_error
helper :issues
include TimelogHelper
@@ -303,4 +304,9 @@ class TimelogController < ApplicationController
def retrieve_time_entry_query
retrieve_query(TimeEntryQuery, false, :defaults => @default_columns_names)
end
+
+ def query_error(exception)
+ session.delete(:time_entry_query)
+ super
+ end
end