diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-05-20 19:02:58 +0100 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-05-20 19:07:05 +0100 |
commit | 79b38c386ae3817df5321522ab9ea169c028de96 (patch) | |
tree | 61f9c270b0218baf7563b8a7bde7377b5043cc58 /actionpack/lib | |
parent | 3fc561a1f71edf1c2bae695cafa03909d24a5ca3 (diff) | |
download | rails-79b38c386ae3817df5321522ab9ea169c028de96.tar.gz rails-79b38c386ae3817df5321522ab9ea169c028de96.tar.bz2 rails-79b38c386ae3817df5321522ab9ea169c028de96.zip |
Escape the extension when normalizing the action cache path.
Although no recognized formats use non-ASCII characters, sometimes they
can be included in the :format parameter because of invalid URLS. To
prevent encoding incompatibility errors we need to escape them before
passing the path to URI.unescape.
Closes #4379
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/caching/actions.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/caching/actions.rb b/actionpack/lib/action_controller/caching/actions.rb index 80901b8bf3..0238135bc1 100644 --- a/actionpack/lib/action_controller/caching/actions.rb +++ b/actionpack/lib/action_controller/caching/actions.rb @@ -47,7 +47,7 @@ module ActionController #:nodoc: # And you can also use <tt>:if</tt> (or <tt>:unless</tt>) to pass a # proc that specifies when the action should be cached. # - # As of Rails 3.0, you can also pass <tt>:expires_in</tt> with a time + # As of Rails 3.0, you can also pass <tt>:expires_in</tt> with a time # interval (in seconds) to schedule expiration of the cached item. # # The following example depicts some of the points made above: @@ -178,8 +178,9 @@ module ActionController #:nodoc: private def normalize!(path) + ext = URI.parser.escape(extension) if extension path << 'index' if path[-1] == ?/ - path << ".#{extension}" if extension and !path.split('?', 2).first.ends_with?(".#{extension}") + path << ".#{ext}" if extension and !path.split('?', 2).first.ends_with?(".#{ext}") URI.parser.unescape(path) end end |