diff --git a/lib/querystring.js b/lib/querystring.js index 9b4ca27640aa71..3dc338b0d5c8b0 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -347,7 +347,7 @@ function parse(qs, sep, eq, options) { keyEncoded = valEncoded = customDecode; encodeCheck = 0; key = value = ''; - posIdx = lastPos; + posIdx = i; lastPos = i + 1; sepIdx = eqIdx = 0; } diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js index baa426094c77c6..b35cc68df9d7c7 100644 --- a/test/parallel/test-querystring.js +++ b/test/parallel/test-querystring.js @@ -59,6 +59,8 @@ const qsTestCases = [ ['&&&&', '', {}], ['&=&', '=', { '': '' }], ['&=&=', '=&=', { '': [ '', '' ]}], + ['a&&b', 'a=&b=', { 'a': '', 'b': '' }], + ['a=a&&b=b', 'a=a&b=b', { 'a': 'a', 'b': 'b' }], [null, '', {}], [undefined, '', {}] ];