Skip to content

Commit

Permalink
Merge pull request #17347 from opf/bug/59865-trailing-in-journal-diff…
Browse files Browse the repository at this point in the history
…-parameter-activity_page-breaks-page

Improve robustness of activity back url
  • Loading branch information
dombesz authored Dec 5, 2024
2 parents d7bb2f0 + e3e95d1 commit 5556368
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/helpers/journals_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def back_to_activity_page_url(activity_page)
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
Expand Down
2 changes: 2 additions & 0 deletions spec/helpers/journals_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"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
Expand Down

0 comments on commit 5556368

Please sign in to comment.