From f8ba21a1d514db878ded2d08996f85055ac3ac8f 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 ec9ada61cd..5ebdaa9c7e 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 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('/')