Skip to content

Commit

Permalink
fixup! Move request controller numerical redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
gbp committed Dec 7, 2023
1 parent 7e7e968 commit 8890dc3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion config/routes/redirects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ def redirect_to_info_request_url_title_path(request:, locale:, id:, suffix: nil)
# encode path components
encoded_parts = [
locale, 'request', info_request.url_title, *suffix
].map { URI.encode_uri_component(_1) }
].map do |part|
if ENV['RUBY_VERSION'] < "3.1"
URI.encode_www_form_component(part).gsub('+', '%20')
else
URI.encode_uri_component(part)
end
end

# join encoded parts together with slashes
encoded_parts.join('/')
Expand Down

0 comments on commit 8890dc3

Please sign in to comment.