aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEduard Bondarenko <edbond@gmail.com>2009-05-27 14:53:05 -0500
committerJoshua Peek <josh@joshpeek.com>2009-05-27 14:53:05 -0500
commit61c471eebb3718a3ef5741e1e4d0974be7483290 (patch)
treecbcd933b70f82bcd850b9c391b4ea37b00ae3d54
parentbb8e5843f32b13e759da51a4713a31b23ebcac6d (diff)
downloadrails-61c471eebb3718a3ef5741e1e4d0974be7483290.tar.gz
rails-61c471eebb3718a3ef5741e1e4d0974be7483290.tar.bz2
rails-61c471eebb3718a3ef5741e1e4d0974be7483290.zip
Add % to RESERVED_PCHAR [#2574 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
-rw-r--r--actionpack/lib/action_controller/routing/segments.rb2
-rw-r--r--actionpack/test/controller/routing_test.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/routing/segments.rb b/actionpack/lib/action_controller/routing/segments.rb
index 4f936d51d2..2603855476 100644
--- a/actionpack/lib/action_controller/routing/segments.rb
+++ b/actionpack/lib/action_controller/routing/segments.rb
@@ -1,7 +1,7 @@
module ActionController
module Routing
class Segment #:nodoc:
- RESERVED_PCHAR = ':@&=+$,;'
+ RESERVED_PCHAR = ':@&=+$,;%'
SAFE_PCHAR = "#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}"
if RUBY_VERSION >= '1.9'
UNSAFE_PCHAR = Regexp.new("[^#{SAFE_PCHAR}]", false).freeze
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index 11bffdb42e..1694fc8f3e 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -90,6 +90,11 @@ class StaticSegmentTest < Test::Unit::TestCase
assert_equal 'Hello World', s.interpolation_chunk
end
+ def test_value_should_not_be_double_unescaped
+ s = ROUTING::StaticSegment.new('%D0%9A%D0%B0%D1%80%D1%82%D0%B0') # Карта
+ assert_equal '%D0%9A%D0%B0%D1%80%D1%82%D0%B0', s.interpolation_chunk
+ end
+
def test_regexp_chunk_should_escape_specials
s = ROUTING::StaticSegment.new('Hello*World')
assert_equal 'Hello\*World', s.regexp_chunk