From 69339e54d3464c6e4193ce744f975fd52b348449 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 1 Aug 2013 10:43:45 -0300 Subject: Fix `current_page?` when the URL contains escaped characters In some cases webservers like nginx send the escaped characters lowercased to the Rails application. The current_page? helper was comparing the escaped strings that are different since Ruby escapes the URL using uppercased characters. --- actionview/lib/action_view/helpers/url_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview/lib/action_view/helpers/url_helper.rb') diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index a4f04b0b3b..6bfcfad60a 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -536,9 +536,9 @@ module ActionView request_uri = url_string.index("?") ? request.fullpath : request.path if url_string =~ /^\w+:\/\// - url_string == "#{request.protocol}#{request.host_with_port}#{request_uri}" + URI.unescape(url_string) == URI.unescape("#{request.protocol}#{request.host_with_port}#{request_uri}") else - url_string == request_uri + URI.unescape(url_string) == URI.unescape(request_uri) end end -- cgit v1.2.3