Permalink
Browse files

No need to unescape params twice if we came from Rack::Mount

  • Loading branch information...
1 parent ff4c218 commit b8af484476d1dda685f058a0f185608cd18a862e @wycats wycats committed Jun 4, 2010
Showing with 7 additions and 7 deletions.
  1. +7 −7 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -29,13 +29,6 @@ def call(env)
def prepare_params!(params)
merge_default_action!(params)
split_glob_param!(params) if @glob_param
-
- params.each do |key, value|
- if value.is_a?(String)
- value = value.dup.force_encoding(Encoding::BINARY) if value.respond_to?(:force_encoding)
- params[key] = URI.unescape(value)
- end
- end
end
def controller(params, raise_error=true)
@@ -466,6 +459,13 @@ def recognize_path(path, environment = {})
req = Rack::Request.new(env)
@set.recognize(req) do |route, matches, params|
+ params.each do |key, value|
+ if value.is_a?(String)
+ value = value.dup.force_encoding(Encoding::BINARY) if value.encoding_aware?
+ params[key] = URI.unescape(value)
+ end
+ end
+
dispatcher = route.app
if dispatcher.is_a?(Dispatcher) && dispatcher.controller(params, false)
dispatcher.prepare_params!(params)

0 comments on commit b8af484

Please sign in to comment.