lib/locomotive/steam/middlewares/path.rb in locomotivecms_steam-0.1.2.pre.beta vs lib/locomotive/steam/middlewares/path.rb in locomotivecms_steam-1.0.0.pre.alpha

- old
+ new

@@ -2,24 +2,21 @@ module Middlewares # Sanitize the path from the previous middleware in order # to make it work for the renderer. # - class Path < Base + class Path < Struct.new(:app) - def _call(env) - super - - self.set_path!(env) - + def call(env) + set_path!(env) app.call(env) end protected def set_path!(env) - path = env['PATH_INFO'].clone + path = env['steam.path'] || request.path_info path.gsub!(/\.[a-zA-Z][a-zA-Z0-9]{2,}$/, '') path.gsub!(/^\//, '') path.gsub!(/^[A-Z]:\//, '') @@ -29,6 +26,6 @@ end end end -end \ No newline at end of file +end