lib/spree/frontend/middleware/seo_assist.rb in solidus_frontend-1.2.3 vs lib/spree/frontend/middleware/seo_assist.rb in solidus_frontend-1.3.0.beta1

- old
+ new

@@ -11,17 +11,17 @@ request = Rack::Request.new(env) params = request.params taxon_id = params['taxon'] - #redirect requests using taxon id's to their permalinks + # redirect requests using taxon id's to their permalinks if !taxon_id.blank? && !taxon_id.is_a?(Hash) && taxon = Taxon.find(taxon_id) params.delete('taxon') return build_response(params, "#{request.script_name}t/#{taxon.permalink}" ) elsif env["PATH_INFO"] =~ /^\/(t|products)(\/\S+)?\/$/ - #ensures no trailing / for taxon and product urls + # ensures no trailing / for taxon and product urls return build_response(params, env["PATH_INFO"][0...-1]) end @app.call(env) @@ -30,11 +30,11 @@ private def build_response(params, location) query = build_query(params) location += '?' + query unless query.blank? - [301, { 'Location'=> location }, []] + [301, { 'Location' => location }, []] end def build_query(params) params.map { |k, v| if v.class == Array @@ -42,10 +42,9 @@ else k + "=" + Rack::Utils.escape(v) end }.join("&") end - end end end end