[#660] cli/container: Use version.IsValid in parseEACL

Extended ACL input can have version later than CLI one, and it should not be
downgraded. But the version should be still adequate.

Set `pkg.SDKVersion` on false return of `version.IsValid`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
remotes/fyrchik/meta-pebble
Leonard Lyubich 2021-07-02 08:47:00 +03:00 committed by Alex Vanin
parent 69826ebd90
commit d610346a7b
1 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@ import (
"github.com/nspcc-dev/neofs-api-go/pkg/object"
"github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-api-go/pkg/session"
"github.com/nspcc-dev/neofs-node/pkg/core/version"
"github.com/nspcc-dev/neofs-sdk-go/pkg/policy"
"github.com/spf13/cobra"
)
@ -845,8 +846,8 @@ func parseEACL(eaclPath string) (*eacl.Table, error) {
table := eacl.NewTable()
if err = table.UnmarshalJSON(data); err == nil {
version := table.Version()
if err := pkg.IsSupportedVersion(&version); err != nil {
v := table.Version()
if !version.IsValid(v) {
table.SetVersion(*pkg.SDKVersion())
}