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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
make sure context is a hash
Markus Kahl456522d23d39
diff --git a/lib/open_project/logging/log_delegator.rb b/lib/open_project/logging/log_delegator.rbindex 0ff775df15a..52c3efe9b82 100644--- a/lib/open_project/logging/log_delegator.rb+++ b/lib/open_project/logging/log_delegator.rb@@ -6,6 +6,14 @@ module OpenProject# Consume a message and let it be handled# by all handlersdef 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').+ if context.respond_to?(:to_unsafe_h)+ context = context.to_unsafe_h+ else+ context = context.to_h.dup+ end+message =if exception.is_a? Exceptioncontext[:exception] = exception@@ -24,7 +32,7 @@ module OpenProjectcontext[:current_user] ||= User.currentregistered_handlers.values.each do |handler|- handler.call message, context.to_h+ handler.call message, contextrescue StandardError => eRails.logger.error "Failed to delegate log to #{handler.inspect}: #{e.inspect}\nMessage: #{message.inspect}"end