Skip to content

Commit

Permalink
neofs: Write object payload if exists
Browse files Browse the repository at this point in the history
Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Sep 12, 2023
1 parent f9c431c commit b97b9bf
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/neofs/neofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Check warning on line 266 in internal/neofs/neofs.go

View check run for this annotation

Codecov / codecov/patch

internal/neofs/neofs.go#L262-L266

Added lines #L262 - L266 were not covered by tests

prm.Payload = bytes.NewReader(obj.Payload())

Check warning on line 268 in internal/neofs/neofs.go

View check run for this annotation

Codecov / codecov/patch

internal/neofs/neofs.go#L268

Added line #L268 was not covered by tests
}

var prmObjPutInit client.PrmObjectPutInit
Expand Down

0 comments on commit b97b9bf

Please sign in to comment.