From c1a5b831b61e8c5004a7861f229906cf94dd33c4 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 2 Feb 2024 20:26:14 +0300 Subject: [PATCH] [#955] chainbase: Fix rule chain unmarshalling * Use correct way DecodeBytes instead unmarshalling by json. Signed-off-by: Airat Arifullin --- pkg/ape/chainbase/boltdb.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/ape/chainbase/boltdb.go b/pkg/ape/chainbase/boltdb.go index c26156c7a..a1dfc2567 100644 --- a/pkg/ape/chainbase/boltdb.go +++ b/pkg/ape/chainbase/boltdb.go @@ -2,7 +2,6 @@ package chainbase import ( "context" - "encoding/json" "errors" "fmt" "path/filepath" @@ -203,7 +202,7 @@ func (cs *boltLocalOverrideStorage) GetOverride(name chain.Name, target policyen } c := &chain.Chain{} - if err := json.Unmarshal(serializedChain, c); err != nil { + if err := c.DecodeBytes(serializedChain); err != nil { return nil, err } return c, nil @@ -241,7 +240,7 @@ func (cs *boltLocalOverrideStorage) ListOverrides(name chain.Name, target policy chains := make([]*chain.Chain, 0, len(serializedChains)) for _, serializedChain = range serializedChains { c := &chain.Chain{} - if err := json.Unmarshal(serializedChain, c); err != nil { + if err := c.DecodeBytes(serializedChain); err != nil { return nil, err } chains = append(chains, c)