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

Remove catastrophic regex

Christophe Bliard387098808ae8
diff --git a/modules/reporting/lib/report/query_utils.rb b/modules/reporting/lib/report/query_utils.rb
index acca09f7ebf..38aba4cc486 100644
--- a/modules/reporting/lib/report/query_utils.rb
+++ b/modules/reporting/lib/report/query_utils.rb
@@ -155,10 +155,8 @@ module Report::QueryUtils
# @param [Hash] options Condition => Result.
# @return [String] Case statement.
def switch(options)
- desc = "#{__method__} #{options.inspect[1..-2]}".gsub(/(Cost|Time)Entry\([^)]*\)/, '\1Entry')
options = options.with_indifferent_access
else_part = options.delete :else
- "-- #{desc}\n\t" \
"CASE #{options.map do |k, v|
"\n\t\tWHEN #{field_name_for k}\n\t\t" \
"THEN #{field_name_for v}"