From 8890dc38cba17762d2f3bde4c25adfc57b8ec288 Mon Sep 17 00:00:00 2001 From: Graeme Porteous Date: Thu, 7 Dec 2023 14:17:38 +0000 Subject: [PATCH] fixup! Move request controller numerical redirect --- config/routes/redirects.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/routes/redirects.rb b/config/routes/redirects.rb index ec9ada61cd9..b41b7ee0455 100644 --- a/config/routes/redirects.rb +++ b/config/routes/redirects.rb @@ -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('/')