class Rack::Protection::PathTraversal

def cleanup(path)

def cleanup(path)
  return cleanup("/" << path)[1..-1] unless path[0] == ?/
  escaped = ::File.expand_path path.gsub('%2e', '.').gsub('%2f', '/')
  escaped << '/' if escaped[-1] != ?/ and path =~ /\/\.{0,2}$/
  escaped.gsub /\/\/+/, '/'
end