Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:sstephenson/prototype

  • Loading branch information...
commit e3d5200cef3236b257ddcfb1eb3eabc5c586bedd 2 parents faa0ba9 + 1d16dec
@savetheclocktower savetheclocktower authored
View
7 src/prototype/lang/string.js
@@ -473,8 +473,11 @@ Object.extend(String.prototype, (function() {
if ((pair = pair.split('='))[0]) {
var key = decodeURIComponent(pair.shift()),
value = pair.length > 1 ? pair.join('=') : pair[0];
-
- if (value != undefined) value = decodeURIComponent(value);
+
+ if (value != undefined) {
+ value = value.gsub('+', ' ');
+ value = decodeURIComponent(value);
+ }
if (key in hash) {
if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
View
1  test/unit/hash_test.js
@@ -120,6 +120,7 @@ new Test.Unit.Runner({
this.assertEqual('a=A&b=B&c=C&d=D%23', $H(Fixtures.many).toQueryString());
this.assertEqual("a=b&c", $H(Fixtures.value_undefined).toQueryString());
this.assertEqual("a=b&c", $H("a=b&c".toQueryParams()).toQueryString());
+ this.assertEqual("a=b+d&c", $H("a=b+d&c".toQueryParams()).toQueryString());
this.assertEqual("a=b&c=", $H(Fixtures.value_null).toQueryString());
this.assertEqual("a=b&c=0", $H(Fixtures.value_zero).toQueryString());
this.assertEqual("color=r&color=g&color=b", $H(Fixtures.multiple).toQueryString());
View
3  test/unit/string_test.js
@@ -390,7 +390,8 @@ new Test.Unit.Runner({
this.assertHashEqual({a:undefined}, 'a'.toQueryParams(), 'key without value');
this.assertHashEqual({a:'b'}, 'a=b&=c'.toQueryParams(), 'empty key');
this.assertHashEqual({a:'b', c:''}, 'a=b&c='.toQueryParams(), 'empty value');
-
+ this.assertHashEqual({a:' '}, 'a=++'.toQueryParams(), 'value of spaces');
+
this.assertHashEqual({'a b':'c', d:'e f', g:'h'},
'a%20b=c&d=e%20f&g=h'.toQueryParams(), 'proper decoding');
this.assertHashEqual({a:'b=c=d'}, 'a=b=c=d'.toQueryParams(), 'multiple equal signs');
Please sign in to comment.
Something went wrong with that request. Please try again.