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 27779de
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions internal/neofs/neofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ func (x *NeoFS) CreateObject(ctx context.Context, prm layer.PrmObjectCreate) (oi
return oid.ID{}, fmt.Errorf("save object via connection pool: %w", err)
}

// Lock payload has been written to header directly, thus we shouldn't miss this payload too.
if data := obj.Payload(); len(data) > 0 {
if prm.Payload != nil {
prm.Payload = io.MultiReader(bytes.NewReader(data), prm.Payload)
} else {
prm.Payload = bytes.NewReader(data)
}

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

View check run for this annotation

Codecov / codecov/patch

internal/neofs/neofs.go#L281-L286

Added lines #L281 - L286 were not covered by tests
}

chunk := make([]byte, x.maxObjectSize)
_, err = io.CopyBuffer(writer, prm.Payload, chunk)
if err != nil {
Expand Down

0 comments on commit 27779de

Please sign in to comment.