From aad4862c59787ed8c826a93ae65409329e8560cb Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 14 Jul 2022 13:23:16 +0300 Subject: [PATCH] [#564] Don't parse lock attribute if it is omitted in container Signed-off-by: Alex Vanin --- api/layer/container.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/api/layer/container.go b/api/layer/container.go index 176ce8c38..fb17c22c9 100644 --- a/api/layer/container.go +++ b/api/layer/container.go @@ -60,13 +60,14 @@ func (n *layer) containerInfo(ctx context.Context, idCnr cid.ID) (*data.BucketIn info.LocationConstraint = cnr.Attribute(attributeLocationConstraint) attrLockEnabled := cnr.Attribute(AttributeLockEnabled) - - info.ObjectLockEnabled, err = strconv.ParseBool(attrLockEnabled) - if err != nil { - log.Error("could not parse container object lock enabled attribute", - zap.String("lock_enabled", attrLockEnabled), - zap.Error(err), - ) + if len(attrLockEnabled) > 0 { + info.ObjectLockEnabled, err = strconv.ParseBool(attrLockEnabled) + if err != nil { + log.Error("could not parse container object lock enabled attribute", + zap.String("lock_enabled", attrLockEnabled), + zap.Error(err), + ) + } } if err = n.bucketCache.Put(info); err != nil {