lib/action_dispatch/journey/router/utils.rb in actionpack-4.0.0 vs lib/action_dispatch/journey/router/utils.rb in actionpack-4.0.1.rc1
- old
+ new
@@ -5,18 +5,21 @@
class Router # :nodoc:
class Utils # :nodoc:
# Normalizes URI path.
#
# Strips off trailing slash and ensures there is a leading slash.
+ # Also converts downcase url encoded string to uppercase.
#
# normalize_path("/foo") # => "/foo"
# normalize_path("/foo/") # => "/foo"
# normalize_path("foo") # => "/foo"
# normalize_path("") # => "/"
+ # normalize_path("/%ab") # => "/%AB"
def self.normalize_path(path)
path = "/#{path}"
path.squeeze!('/')
path.sub!(%r{/+\Z}, '')
+ path.gsub!(/(%[a-f0-9]{2}+)/) { $1.upcase }
path = '/' if path == ''
path
end
# URI path and fragment escaping