mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-26 09:42:22 +00:00
cli: fix missing errors on closure of writer in upload-bin
Ref #3658 Signed-off-by: Ekaterina Pavlova <ekt@morphbits.io>
This commit is contained in:
parent
1a540d5883
commit
18ed3bb3e8
1 changed files with 9 additions and 1 deletions
|
@ -581,11 +581,19 @@ func uploadObj(ctx context.Context, p *pool.Pool, signer user.Signer, owner util
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to initiate object upload: %w", err)
|
return fmt.Errorf("failed to initiate object upload: %w", err)
|
||||||
}
|
}
|
||||||
defer writer.Close()
|
|
||||||
_, err = writer.Write(objData)
|
_, err = writer.Write(objData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
_ = writer.Close()
|
||||||
return fmt.Errorf("failed to write object data: %w", err)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue