Skip to content
Browse files

Fixed an issue with returned data getting corrupted when the detect_b…

…uffers options is set to true.

This happens when you have a hgetall request in a multi
  • Loading branch information...
1 parent 3a7c638 commit efbcc00332daff1cb6cba5da53a91516ae638601 @dayananda-n committed Nov 24, 2011
Showing with 12 additions and 4 deletions.
  1. +12 −4 index.js
View
16 index.js
@@ -506,6 +506,17 @@ function reply_to_object(reply) {
return obj;
}
+function reply_from_array(reply) {
+ var i;
+ for (i = 0; i < reply.length; i++) {
+ if (Array.isArray(reply[i])) {
+ reply_from_array(reply[i]);
+ } else if (Buffer.isBuffer(reply[i])) {
+ reply[i] = reply[i].toString();
+ }
+ }
+}
+
function reply_to_strings(reply) {
var i;
@@ -514,10 +525,7 @@ function reply_to_strings(reply) {
}
if (Array.isArray(reply)) {
- for (i = 0; i < reply.length; i++) {
- reply[i] = reply[i].toString();
- }
- return reply;
+ reply_from_array(reply);
}
return reply;

0 comments on commit efbcc00

Please sign in to comment.
Something went wrong with that request. Please try again.