Skip to content

Commit

Permalink
Properly insert buffers in arrays.
Browse files Browse the repository at this point in the history
Before this commit, when someone tried to insert a Buffer into an array,
the library would try to escape it (by calling the `escapeElement` on
it), which would fail because buffers don't have a `replace` method.
  • Loading branch information
2Pacalypse- authored and brianc committed Jul 14, 2017
1 parent dbf3bd3 commit c2af53a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ function arrayString(val) {
else if(Array.isArray(val[i])) {
result = result + arrayString(val[i]);
}
else if(val[i] instanceof Buffer) {
result += '\\\\x' + val[i].toString('hex');
}
else
{
result += escapeElement(prepareValue(val[i]));
Expand Down

0 comments on commit c2af53a

Please sign in to comment.