class ActionDispatch::Journey::Router::Utils
def self.normalize_path(path)
normalize_path("") # => "/"
normalize_path("foo") # => "/foo"
normalize_path("/foo/") # => "/foo"
normalize_path("/foo") # => "/foo"
Also converts downcase url encoded string to uppercase.
Strips off trailing slash and ensures there is a leading slash.
Normalizes URI path.
:nodoc:
:nodoc:
:nodoc:
def self.normalize_path(path) path = "/#{path}" path.squeeze!('/'.freeze) path.sub!(%r{/+\Z}, ''.freeze) path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase } path = '/' if path == ''.freeze path end