diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-22 16:11:15 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-09-27 11:19:20 -0300 |
commit | 5d773f8dedef85f3ef5d3bdebcedd72716002268 (patch) | |
tree | 6051c353ec7258013e864bd56ba443d13b95d178 /actionpack/lib/action_controller/caching | |
parent | 535371e956b648daff80b1c727b609749ac7137b (diff) | |
download | rails-5d773f8dedef85f3ef5d3bdebcedd72716002268.tar.gz rails-5d773f8dedef85f3ef5d3bdebcedd72716002268.tar.bz2 rails-5d773f8dedef85f3ef5d3bdebcedd72716002268.zip |
Remove warning "URI.unescape is obsolete" from actionpack.
Diffstat (limited to 'actionpack/lib/action_controller/caching')
-rw-r--r-- | actionpack/lib/action_controller/caching/actions.rb | 6 | ||||
-rw-r--r-- | actionpack/lib/action_controller/caching/pages.rb | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index a3591eafbe..e00f4a7b1d 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -161,7 +161,11 @@ module ActionController #:nodoc: def normalize!(path) path << 'index' if path[-1] == ?/ path << ".#{extension}" if extension and !path.ends_with?(extension) - URI.unescape(path) + uri_parser.unescape(path) + end + + def uri_parser + @uri_parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI end end end 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: |