protobuf.js version: 6.8.8 (fetched through grpc 1.20-pre1)
Long 'hash' keys are not interpreted correctly when constructing map<int64, Obj>
For messages like that
message Obj {}
message MyMessage {
map<int64, Obj> MyMap = 1;
}
creating message with
proto.MyMessage.create({
MyMap: {
['\u0002\u0000\u0000\u0000\u0000\u0000\u0000\u0000']: {}
}
})
creates seemingly valid object, prints out as
MyMessage { MyMap: { '\u0002\u0000\u0000\u0000\u0000\u0000\u0000\u0000': {} }
but after encoding and decoding it, the key is changed to 0:
proto.MyMessage.decode(proto.MyMessage.encode(req).finish());
prints
MyMessage {
MyMap:
{ '\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000': Obj {} } }
protobuf.js version: 6.8.8 (fetched through grpc 1.20-pre1)
Long 'hash' keys are not interpreted correctly when constructing map<int64, Obj>
For messages like that
creating message with
creates seemingly valid object, prints out as
but after encoding and decoding it, the key is changed to 0:
prints