Skip to content

Commit be1c421

Browse files
committed
v6.0.3
1 parent 938f24e commit be1c421

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## **6.0.3**
2+
- [Fix] ensure that `allowPrototypes: false` does not ever shadow Object.prototype properties
3+
- [Fix] Restore `dist` directory; will be removed in v7 (#148)
4+
15
## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed)
26
- Revert ES6 requirement and restore support for node down to v0.8.
37

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": "5.2.0",
5+
"version": "6.0.3",
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 @@ internals.parseObject = function (chain, val, options) {
6767
obj = obj.concat(internals.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 @@ internals.parseKeys = function (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 @@ internals.parseKeys = function (givenKey, val, options) {
123123
var i = 0;
124124
while ((segment = child.exec(key)) !== null && i < options.depth) {
125125
i += 1;
126-
if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) {
126+
if (!options.plainObjects && Object.prototype.hasOwnProperty.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.0.2",
5+
"version": "6.0.3",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/ljharb/qs.git"

0 commit comments

Comments
 (0)