From 8b43c33e44a45dbb2f0ae00e755ad9e0b3a0cbab Mon Sep 17 00:00:00 2001 From: Ekaterina Pavlova Date: Wed, 23 Oct 2024 13:14:35 +0300 Subject: [PATCH] cli: extend object attribute parsing error in `upload-bin` Signed-off-by: Ekaterina Pavlova --- cli/util/uploader.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cli/util/uploader.go b/cli/util/uploader.go index 28ae5a23a..f8e049ad4 100644 --- a/cli/util/uploader.go +++ b/cli/util/uploader.go @@ -483,7 +483,12 @@ func uploadObj(ctx context.Context, p *pool.Pool, signer user.Signer, owner util func getBlockIndex(header *object.Object, attribute string) (int, error) { for _, attr := range header.UserAttributes() { if attr.Key() == attribute { - return strconv.Atoi(attr.Value()) + value := attr.Value() + blockIndex, err := strconv.Atoi(value) + if err != nil { + return -1, fmt.Errorf("attribute %s has invalid value: %s, error: %w", attribute, value, err) + } + return blockIndex, nil } } return -1, fmt.Errorf("attribute %s not found", attribute)