mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Add % to RESERVED_PCHAR [#2574 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
committed by
Joshua Peek
parent
bb8e5843f3
commit
61c471eebb
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user