Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

make sure to use plain hash to avoid argument error

Markus Kahlc000527b36a7
diff --git a/lib/open_project/logging/log_delegator.rb b/lib/open_project/logging/log_delegator.rb
index 2828796445c..d18bc08319b 100644
--- a/lib/open_project/logging/log_delegator.rb
+++ b/lib/open_project/logging/log_delegator.rb
@@ -6,8 +6,7 @@ module OpenProject
# Consume a message and let it be handled
# by all handlers
def log(exception, context = {})
- # Doing the following because this is called with ActionController::Parameters from somewhere
- # which leads to "failed to delegate" errors below ('expect the argument to be a Hash').
+ # in case we're getting ActionController::Parameters
if context.respond_to?(:to_unsafe_h)
context = context.to_unsafe_h
else
diff --git a/lib/open_project/logging/sentry_logger.rb b/lib/open_project/logging/sentry_logger.rb
index 88d9511476d..207d17e1327 100644
--- a/lib/open_project/logging/sentry_logger.rb
+++ b/lib/open_project/logging/sentry_logger.rb
@@ -80,7 +80,10 @@ module OpenProject
def filter_params(params)
f = ActiveSupport::ParameterFilter.new(Rails.application.config.filter_parameters)
- f.filter params
+ res = f.filter(params)
+
+ # make sure to return plain hash rather than ActionController::Parameters
+ res.respond_to?(:to_unsafe_h) ? res.to_unsafe_h : res.to_h
rescue => e
{ filter_failed: e.message }
end