[#955] chainbase: Fix rule chain unmarshalling
All checks were successful
DCO action / DCO (pull_request) Successful in 4m41s
Vulncheck / Vulncheck (pull_request) Successful in 4m46s
Tests and linters / Staticcheck (pull_request) Successful in 6m30s
Tests and linters / Lint (pull_request) Successful in 7m36s
Build / Build Components (1.21) (pull_request) Successful in 8m57s
Build / Build Components (1.20) (pull_request) Successful in 9m8s
Tests and linters / Tests (1.21) (pull_request) Successful in 10m32s
Tests and linters / Tests (1.20) (pull_request) Successful in 10m42s
Tests and linters / Tests with -race (pull_request) Successful in 11m23s
All checks were successful
DCO action / DCO (pull_request) Successful in 4m41s
Vulncheck / Vulncheck (pull_request) Successful in 4m46s
Tests and linters / Staticcheck (pull_request) Successful in 6m30s
Tests and linters / Lint (pull_request) Successful in 7m36s
Build / Build Components (1.21) (pull_request) Successful in 8m57s
Build / Build Components (1.20) (pull_request) Successful in 9m8s
Tests and linters / Tests (1.21) (pull_request) Successful in 10m32s
Tests and linters / Tests (1.20) (pull_request) Successful in 10m42s
Tests and linters / Tests with -race (pull_request) Successful in 11m23s
* Use correct way DecodeBytes instead unmarshalling by json. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
befbaf9d56
commit
c1a5b831b6
1 changed files with 2 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue