From b97b9bf1ff8e95c46c981835255d7f6d6d53b790 Mon Sep 17 00:00:00 2001 From: Evgenii Baidakov Date: Tue, 12 Sep 2023 11:16:29 +0400 Subject: [PATCH] neofs: Write object payload if exists Signed-off-by: Evgenii Baidakov --- internal/neofs/neofs.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/neofs/neofs.go b/internal/neofs/neofs.go index 5a8adbd1..bcc0e730 100644 --- a/internal/neofs/neofs.go +++ b/internal/neofs/neofs.go @@ -259,6 +259,13 @@ func (x *NeoFS) CreateObject(ctx context.Context, prm layer.PrmObjectCreate) (oi var lock object.Lock lock.WriteMembers(prm.Locks) obj.WriteLock(lock) + + // we can't have locks and payload at the same time. + if len(obj.Payload()) > 0 && prm.Payload != nil { + return oid.ID{}, errors.New("lock object with payload") + } + + prm.Payload = bytes.NewReader(obj.Payload()) } var prmObjPutInit client.PrmObjectPutInit