Skip to content

Commit

Permalink
Fix decode plugin with protobuf decoder (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillov6 authored Dec 12, 2024
1 parent cfe8d68 commit 1da9776
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions plugin/action/decode/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,11 @@ func (p *Plugin) decodeNginxError(root *insaneJSON.Root, node *insaneJSON.Node)
}

func (p *Plugin) decodeProtobuf(root *insaneJSON.Root, node *insaneJSON.Node, buf []byte) {
t := insaneJSON.Spawn()
defer insaneJSON.Release(t)

err := p.decoder.DecodeToJson(t, node.AsBytes())
jsonRaw, err := p.decoder.Decode(node.AsBytes())
if p.checkError(err, node) {
return
}
t, err := root.DecodeBytesAdditional(jsonRaw.([]byte))
if p.checkError(err, node) {
return
}
Expand All @@ -565,7 +566,7 @@ func (p *Plugin) decodeProtobuf(root *insaneJSON.Root, node *insaneJSON.Node, bu
node.Suicide()
}

root.MergeWith(t.Node)
root.MergeWith(t)
}

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

0 comments on commit 1da9776

Please sign in to comment.