Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed the + sign as an accepted character from the parameterize met…

…hod, 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>
  • Loading branch information...
commit f6f75e84c5a186ea4c689dd8b7ae0da391c226ef 1 parent d3a8152
@stijnster stijnster authored jeremy committed
View
2  activesupport/lib/active_support/inflector.rb
@@ -260,7 +260,7 @@ def parameterize(string, sep = '-')
# replace accented chars with ther ascii equivalents
parameterized_string = transliterate(string)
# Turn unwanted chars into the seperator
- parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep)
+ parameterized_string.gsub!(/[^a-z0-9\-_]+/i, sep)
unless sep.blank?
re_sep = Regexp.escape(sep)
# No more than one of the separator in a row.
View
9 activesupport/test/inflector_test_cases.rb
@@ -151,7 +151,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 = {
@@ -159,7 +160,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 = {
@@ -167,7 +169,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.
Please sign in to comment.
Something went wrong with that request. Please try again.