aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/caching/pages.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/caching/pages.rb')
-rw-r--r--actionpack/lib/action_controller/caching/pages.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/caching/pages.rb b/actionpack/lib/action_controller/caching/pages.rb
index 4f7a5d3f55..b845c6f6f9 100644
--- a/actionpack/lib/action_controller/caching/pages.rb
+++ b/actionpack/lib/action_controller/caching/pages.rb
@@ -99,7 +99,7 @@ module ActionController #:nodoc:
private
def page_cache_file(path)
- name = (path.empty? || path == "/") ? "/index" : URI.unescape(path.chomp('/'))
+ name = (path.empty? || path == "/") ? "/index" : uri_parser.unescape(path.chomp('/'))
name << page_cache_extension unless (name.split('/').last || name).include? '.'
return name
end
@@ -111,6 +111,10 @@ module ActionController #:nodoc:
def instrument_page_cache(name, path)
ActiveSupport::Notifications.instrument("#{name}.action_controller", :path => path){ yield }
end
+
+ def uri_parser
+ @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
+ end
end
# Expires the page that was cached with the +options+ as a key. Example: