Skip to content

Commit

Permalink
BBBQ JS - dparam should always return an object
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin-foster-uk committed Dec 31, 2024
1 parent 76d8544 commit 06c1650
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 28 deletions.
10 changes: 5 additions & 5 deletions framework/web/js/source/jquery.ba-bbq.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@
// (Object) An object representing the deserialized params string.

$.deparam = jq_deparam = function( params, coerce ) {
var prohibitedKeys = ['__proto__'];
var prohibited_keys = ['__proto__'];

var obj = Object.create(null),
var obj = {},
coerce_types = { 'true': !0, 'false': !1, 'null': null };

// Iterate over all name=value pairs.
Expand All @@ -490,7 +490,7 @@
keys = key.split( '][' ),
keys_last = keys.length - 1;

if ( prohibitedKeys.includes( key ) ) {
if ( prohibited_keys.includes( key ) ) {
return;
}

Expand Down Expand Up @@ -535,12 +535,12 @@
for ( ; i <= keys_last; i++ ) {
key = keys[i] === '' ? cur.length : keys[i];

if ( prohibitedKeys.includes( key ) ) {
if ( prohibited_keys.includes( key ) ) {
return;
}

cur = cur[key] = i < keys_last
? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? Object.create(null) : [] )
? cur[key] || ( keys[i+1] && isNaN( keys[i+1] ) ? {} : [] )
: val;
}

Expand Down
24 changes: 1 addition & 23 deletions framework/web/js/source/jquery.ba-bbq.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 06c1650

Please sign in to comment.