Skip to content

Commit ff662ec

Browse files
committed
v6.2.2
1 parent 970fb26 commit ff662ec

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## **6.2.2**
2+
- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties
3+
14
## **6.2.1**
25
- [Fix] ensure `key[]=x&key[]&key[]=y` results in 3, not 2, values
36
- [Refactor] Be explicit and use `Object.prototype.hasOwnProperty.call`

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "qs",
33
"repository": "hapijs/qs",
44
"description": "query-string parser / stringifier with nesting support",
5-
"version": "6.1.0",
5+
"version": "6.2.2",
66
"keywords": ["querystring", "query", "parser"],
77
"main": "lib/index.js",
88
"scripts": [

dist/qs.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var parseObject = function parseObject(chain, val, options) {
6767
obj = obj.concat(parseObject(chain, val, options));
6868
} else {
6969
obj = options.plainObjects ? Object.create(null) : {};
70-
var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root;
70+
var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
7171
var index = parseInt(cleanRoot, 10);
7272
if (
7373
!isNaN(index) &&
@@ -96,8 +96,8 @@ var parseKeys = function parseKeys(givenKey, val, options) {
9696

9797
// The regex chunks
9898

99-
var parent = /^([^\[\]]*)/;
100-
var child = /(\[[^\[\]]*\])/g;
99+
var parent = /^([^[]*)/;
100+
var child = /(\[[^[\]]*])/g;
101101

102102
// Get the parent
103103

@@ -123,9 +123,9 @@ var parseKeys = function parseKeys(givenKey, val, options) {
123123
var i = 0;
124124
while ((segment = child.exec(key)) !== null && i < options.depth) {
125125
i += 1;
126-
if (!options.plainObjects && has.call(Object.prototype, segment[1].replace(/\[|\]/g, ''))) {
126+
if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
127127
if (!options.allowPrototypes) {
128-
continue;
128+
return;
129129
}
130130
}
131131
keys.push(segment[1]);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "qs",
33
"description": "A querystring parser that supports nesting and arrays, with a depth limit",
44
"homepage": "https://github.com/ljharb/qs",
5-
"version": "6.2.1",
5+
"version": "6.2.2",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/ljharb/qs.git"

0 commit comments

Comments
 (0)