diff options
author | Stijn Mathysen <stijn@skylight.be> | 2010-03-05 08:04:25 +0100 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-03-05 14:11:21 -0800 |
commit | 67512b9489593ddcd1c0c87ba0052380355b5400 (patch) | |
tree | a256b14cd7cb5df3a007e0ee435f7c3c3d8020d7 /activesupport | |
parent | e472f76e4c86cfc1350f3b769d9ac3d96f062e3f (diff) | |
download | rails-67512b9489593ddcd1c0c87ba0052380355b5400.tar.gz rails-67512b9489593ddcd1c0c87ba0052380355b5400.tar.bz2 rails-67512b9489593ddcd1c0c87ba0052380355b5400.zip |
Removed the + sign as an accepted character from the parameterize method, as a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key"
[#4080 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/inflector/transliterate.rb | 2 | ||||
-rw-r--r-- | activesupport/test/inflector_test_cases.rb | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb index 30a9072ee1..236f2eb628 100644 --- a/activesupport/lib/active_support/inflector/transliterate.rb +++ b/activesupport/lib/active_support/inflector/transliterate.rb @@ -47,7 +47,7 @@ module ActiveSupport # replace accented chars with their ascii equivalents parameterized_string = transliterate(string) # Turn unwanted chars into the separator - parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep) + parameterized_string.gsub!(/[^a-z0-9\-_]+/i, sep) unless sep.nil? || sep.empty? re_sep = Regexp.escape(sep) # No more than one of the separator in a row. diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb index 2fa94b8e9c..ebd26d3fc6 100644 --- a/activesupport/test/inflector_test_cases.rb +++ b/activesupport/test/inflector_test_cases.rb @@ -158,7 +158,8 @@ module InflectorTestCases "Allow_Under_Scores" => "allow_under_scores", "Trailing bad characters!@#" => "trailing-bad-characters", "!@#Leading bad characters" => "leading-bad-characters", - "Squeeze separators" => "squeeze-separators" + "Squeeze separators" => "squeeze-separators", + "Test with + sign" => "test-with-sign" } StringToParameterizeWithNoSeparator = { @@ -166,7 +167,8 @@ module InflectorTestCases "Random text with *(bad)* characters" => "randomtextwithbadcharacters", "Trailing bad characters!@#" => "trailingbadcharacters", "!@#Leading bad characters" => "leadingbadcharacters", - "Squeeze separators" => "squeezeseparators" + "Squeeze separators" => "squeezeseparators", + "Test with + sign" => "testwithsign" } StringToParameterizeWithUnderscore = { @@ -174,7 +176,8 @@ module InflectorTestCases "Random text with *(bad)* characters" => "random_text_with_bad_characters", "Trailing bad characters!@#" => "trailing_bad_characters", "!@#Leading bad characters" => "leading_bad_characters", - "Squeeze separators" => "squeeze_separators" + "Squeeze separators" => "squeeze_separators", + "Test with + sign" => "test_with_sign" } # Ruby 1.9 doesn't do Unicode normalization yet. |