summaryrefslogtreecommitdiff
path: root/lib/querystring.js
diff options
context:
space:
mode:
authorJeremiah Senkpiel <fishrock123@rocketmail.com>2015-03-19 21:33:04 -0400
committerJeremiah Senkpiel <fishrock123@rocketmail.com>2015-03-19 21:47:41 -0400
commitc9aec2b7167a08dc88141fbe3be1c498f8c5b061 (patch)
treec38851bfc5c1ebaffc803830db6d78c33205e643 /lib/querystring.js
parenta89f5c21562fe75b083a270090eadfbe318e5954 (diff)
downloadandroid-node-v8-c9aec2b7167a08dc88141fbe3be1c498f8c5b061.tar.gz
android-node-v8-c9aec2b7167a08dc88141fbe3be1c498f8c5b061.tar.bz2
android-node-v8-c9aec2b7167a08dc88141fbe3be1c498f8c5b061.zip
querystring: fix broken stringifyPrimitive
stringifyPrimitive has always failed to stringify numbers since its introduction in 422d3c9. This went uncaught due to encodeURIComponent's string coercion. Fixes: https://github.com/iojs/io.js/issues/1208 PR-URL: https://github.com/iojs/io.js/pull/1213 Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'lib/querystring.js')
-rw-r--r--lib/querystring.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/querystring.js b/lib/querystring.js
index f0d473a39a..09220a919e 100644
--- a/lib/querystring.js
+++ b/lib/querystring.js
@@ -147,8 +147,10 @@ QueryString.escape = function(str) {
};
var stringifyPrimitive = function(v) {
- if (typeof v === 'string' || (typeof v === 'number' && isFinite(v)))
+ if (typeof v === 'string')
return v;
+ if (typeof v === 'number' && isFinite(v))
+ return '' + v;
if (typeof v === 'boolean')
return v ? 'true' : 'false';
return '';