aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/routing.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-12-28 21:04:44 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-12-28 21:04:44 +0000
commitf9f84d9f6dea72cae4fc8e31448df408caccbd59 (patch)
treee3e5b7928e2b143c0d0140314c961249ec7a1cce /actionpack/lib/action_controller/routing.rb
parent5cf118b1384bce266c76d3f4a12e761bbcb130ab (diff)
downloadrails-f9f84d9f6dea72cae4fc8e31448df408caccbd59.tar.gz
rails-f9f84d9f6dea72cae4fc8e31448df408caccbd59.tar.bz2
rails-f9f84d9f6dea72cae4fc8e31448df408caccbd59.zip
Routing uses URI escaping for path components and CGI escaping for query parameters.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5803 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/routing.rb')
-rw-r--r--actionpack/lib/action_controller/routing.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index 8ae1cb06d9..88b60396c6 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -1,4 +1,5 @@
require 'cgi'
+require 'uri'
class Object
def to_param
@@ -601,7 +602,7 @@ module ActionController
end
def interpolation_chunk
- raw? ? value : CGI.escape(value)
+ raw? ? value : URI.escape(value)
end
def regexp_chunk
@@ -682,7 +683,7 @@ module ActionController
end
def interpolation_chunk
- "\#{CGI.escape(#{local_name}.to_s)}"
+ "\#{URI.escape(#{local_name}.to_s)}"
end
def string_structure(prior_segments)
@@ -731,7 +732,7 @@ module ActionController
"(?i-:(#{(regexp || Regexp.union(*possible_names)).source}))"
end
- # Don't CGI.escape the controller name, since it may have slashes in it,
+ # Don't URI.escape the controller name, since it may have slashes in it,
# like admin/foo.
def interpolation_chunk
"\#{#{local_name}.to_s}"
@@ -753,9 +754,9 @@ module ActionController
end
class PathSegment < DynamicSegment
- EscapedSlash = CGI.escape("/")
+ EscapedSlash = URI.escape("/")
def interpolation_chunk
- "\#{CGI.escape(#{local_name}.to_s).gsub(#{EscapedSlash.inspect}, '/')}"
+ "\#{URI.escape(#{local_name}.to_s).gsub(#{EscapedSlash.inspect}, '/')}"
end
def default
@@ -777,7 +778,7 @@ module ActionController
class Result < ::Array #:nodoc:
def to_s() join '/' end
def self.new_escaped(strings)
- new strings.collect {|str| CGI.unescape str}
+ new strings.collect {|str| URI.unescape str}
end
end
end
@@ -1256,7 +1257,7 @@ module ActionController
end
def recognize_path(path, environment={})
- path = CGI.unescape(path)
+ path = URI.unescape(path)
routes.each do |route|
result = route.recognize(path, environment) and return result
end