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

[#64347] use word boundaries in custom field regex

Tobias Dillmann2245e1c2e10c
diff --git a/app/models/custom_field/calculated_value.rb b/app/models/custom_field/calculated_value.rb
index 220dbb438d6..f9995e52e25 100644
--- a/app/models/custom_field/calculated_value.rb
+++ b/app/models/custom_field/calculated_value.rb
@@ -90,6 +90,6 @@ module CustomField::CalculatedValue
# Returns a list of custom field IDs used in the formula.
# For a formula like `2 + cf_12 + cf_4` it returns `[12, 4]`.
def cf_ids_used_in_formula(formula_str)
- formula_str.scan(/cf_(\d+)/).flatten.map(&:to_i)
+ formula_str.scan(/\bcf_(\d+)\b/).flatten.map(&:to_i)
end
end