GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix #3058 querystring: Fix incorrect handling of empty keys · lightsofapollo/node@a811a4a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • querystring.js
  • test/simple
    • test-querystring.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/querystring.js‎

Copy file name to clipboardExpand all lines: lib/querystring.js
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,11 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq, options) {
189189
kstr = x.substring(0, idx),
190190
vstr = x.substring(idx + 1), k, v;
191191

192+
if (kstr === '' && vstr !== '') {
193+
kstr = vstr;
194+
vstr = '';
195+
}
196+
192197
try {
193198
k = decodeURIComponent(kstr);
194199
v = decodeURIComponent(vstr);
Collapse file

‎test/simple/test-querystring.js‎

Copy file name to clipboardExpand all lines: test/simple/test-querystring.js
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ var qsTestCases = [
5555
{ hasOwnProperty: 'x',
5656
toString: 'foo',
5757
valueOf: 'bar',
58-
__defineGetter__: 'baz' }]
58+
__defineGetter__: 'baz' }],
59+
// See: https://github.com/joyent/node/issues/3058
60+
['foo&bar=baz', 'foo=&bar=baz', { foo: '', bar: 'baz' }]
5961
];
6062

6163
// [ wonkyQS, canonicalQS, obj ]

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.