diff --git a/cli/util/upload_bin.go b/cli/util/upload_bin.go index 7b7f315b1..89a4fdef0 100644 --- a/cli/util/upload_bin.go +++ b/cli/util/upload_bin.go @@ -581,11 +581,19 @@ 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 { + _ = writer.Close() 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() + if res.StoredObjectID().Equals(oid.ID{}) { + return fmt.Errorf("object ID is empty") + } return nil }