Skip to content

Commit 1da9776

Browse files
authored
Fix decode plugin with protobuf decoder (#721)
1 parent cfe8d68 commit 1da9776

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

plugin/action/decode/decode.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -543,10 +543,11 @@ func (p *Plugin) decodeNginxError(root *insaneJSON.Root, node *insaneJSON.Node)
543543
}
544544

545545
func (p *Plugin) decodeProtobuf(root *insaneJSON.Root, node *insaneJSON.Node, buf []byte) {
546-
t := insaneJSON.Spawn()
547-
defer insaneJSON.Release(t)
548-
549-
err := p.decoder.DecodeToJson(t, node.AsBytes())
546+
jsonRaw, err := p.decoder.Decode(node.AsBytes())
547+
if p.checkError(err, node) {
548+
return
549+
}
550+
t, err := root.DecodeBytesAdditional(jsonRaw.([]byte))
550551
if p.checkError(err, node) {
551552
return
552553
}
@@ -565,7 +566,7 @@ func (p *Plugin) decodeProtobuf(root *insaneJSON.Root, node *insaneJSON.Node, bu
565566
node.Suicide()
566567
}
567568

568-
root.MergeWith(t.Node)
569+
root.MergeWith(t)
569570
}
570571

571572
func (p *Plugin) addFieldPrefix(root *insaneJSON.Root, key string, val []byte) {

0 commit comments

Comments
 (0)