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

improve robustness of activity back url

ulfertse3e95d12627a
diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb
index 85217057380..821798a5cec 100644
--- a/app/helpers/journals_helper.rb
+++ b/app/helpers/journals_helper.rb
@@ -38,7 +38,8 @@ module JournalsHelper
in ["users", user_id]
user_url(user_id)
in ["work_packages", work_package_id]
- work_package_url(work_package_id)
+ # Sometimes the parameter provided is erroneous (having an extra ') for unknown reasons.
+ work_package_url(work_package_id.chomp("'"))
else
nil
end
diff --git a/spec/helpers/journals_helper_spec.rb b/spec/helpers/journals_helper_spec.rb
index fb9dcba080e..8910302da9a 100644
--- a/spec/helpers/journals_helper_spec.rb
+++ b/spec/helpers/journals_helper_spec.rb
@@ -38,6 +38,8 @@ RSpec.describe JournalsHelper do
"unsupported_gizmo" => nil,
"users/5" => "http://test.host/users/5",
"work_packages/42" => "http://test.host/work_packages/42",
+ # Sometimes the url is erroneous (having an extra ') for unknown reasons.
+ "work_packages/42'" => "http://test.host/work_packages/42",
nil => nil
}.each do |activity_page, expected_url|
context "when activity page is #{activity_page.inspect}" do