[#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>
This commit is contained in:
Leonard Lyubich 2021-07-02 08:47:00 +03:00 committed by Alex Vanin
parent 69826ebd90
commit d610346a7b

View file

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