Created
August 5, 2010 07:15
-
-
Save cloudhead/509382 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 448750c6bb9c6dc872af6dfd5b2445466d8ffe2a Mon Sep 17 00:00:00 2001 | |
From: cloudhead <[email protected]> | |
Date: Thu, 5 Aug 2010 03:13:40 -0400 | |
Subject: [PATCH] querystring.parse: handle undefined value properly | |
--- | |
lib/querystring.js | 1 + | |
1 files changed, 1 insertions(+), 0 deletions(-) | |
diff --git a/lib/querystring.js b/lib/querystring.js | |
index ba2b1cc..69ea008 100644 | |
--- a/lib/querystring.js | |
+++ b/lib/querystring.js | |
@@ -77,6 +77,7 @@ var chunks = /(?:(?:^|\.)([^\[\(\.]+)(?=\[|\.|$|\()|\[([^"'][^\]]*?)\]|\["([^\]" | |
// Parse a key=val string. | |
QueryString.parse = QueryString.decode = function (qs, sep, eq) { | |
var obj = {}; | |
+ if (qs === undefined) { return {} } | |
String(qs).split(sep || "&").map(function (keyValue) { | |
var res = obj, | |
next, | |
-- | |
1.7.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment