From 9d5ae1c6296df20ac27010503077cc22635c8ca2 Mon Sep 17 00:00:00 2001 From: murgatroid99 <mlumish@google.com> Date: Fri, 5 Jun 2015 13:58:25 -0700 Subject: [PATCH] Fixed handling of long values --- src/node/src/common.js | 4 +++- src/node/test/common_test.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/node/src/common.js b/src/node/src/common.js index 7b543353eb..feaa859a4f 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -47,7 +47,9 @@ function deserializeCls(cls) { * @return {cls} The resulting object */ return function deserialize(arg_buf) { - return cls.decode(arg_buf).toRaw(); + // Convert to a native object with binary fields as Buffers (first argument) + // and longs as strings (second argument) + return cls.decode(arg_buf).toRaw(false, true); }; } diff --git a/src/node/test/common_test.js b/src/node/test/common_test.js index c336955963..08ba429ed7 100644 --- a/src/node/test/common_test.js +++ b/src/node/test/common_test.js @@ -39,7 +39,8 @@ var common = require('../src/common.js'); var ProtoBuf = require('protobufjs'); -var messages_proto = ProtoBuf.loadProtoFile(__dirname + '/test_messages.proto').build(); +var messages_proto = ProtoBuf.loadProtoFile( + __dirname + '/test_messages.proto').build(); describe('Proto message serialize and deserialize', function() { var longSerialize = common.serializeCls(messages_proto.LongValues); -- GitLab