Skip to content

Commit

Permalink
cli: fix missing errors on closure of writer in upload-bin
Browse files Browse the repository at this point in the history
Refs #3658

Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
  • Loading branch information
AliceInHunterland committed Nov 5, 2024
1 parent 95098d4 commit cdd0ff8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cli/util/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,20 @@ func uploadObj(ctx context.Context, p *pool.Pool, signer user.Signer, owner util
if err != nil {
return fmt.Errorf("failed to initiate object upload: %w", err)
}
defer writer.Close()

_, err = writer.Write(objData)
if err != nil {
return fmt.Errorf("failed to write object data: %w", err)
}
err = writer.Close()
if err != nil {
return fmt.Errorf("failed to close object writer: %w", err)
}
res := writer.GetResult()
// This checks preventing gaps in uploaded block sequence ref. #3658.
if res.StoredObjectID().Equals(oid.ID{}) {
return fmt.Errorf("object ID is empty")
}
return nil
}

Expand Down

0 comments on commit cdd0ff8

Please sign in to comment.