forked from TrueCloudLab/frostfs-api-go
[#135] sdk/object: Fix IDFromV2 nil-behavior
Remove nil if-statement from IDFromV2 function to which avoids checking the correctness of the identifier format. From now IDFromV2 returns format error on nil argument. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
59f804faa2
commit
047bae63d0
1 changed files with 0 additions and 4 deletions
|
@ -37,10 +37,6 @@ func (id *ID) ToV2() *refs.ObjectID {
|
||||||
// Returns an error if the format of the identifier
|
// Returns an error if the format of the identifier
|
||||||
// in the message is broken.
|
// in the message is broken.
|
||||||
func IDFromV2(idV2 *refs.ObjectID) (*ID, error) {
|
func IDFromV2(idV2 *refs.ObjectID) (*ID, error) {
|
||||||
if idV2 == nil {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
val := idV2.GetValue()
|
val := idV2.GetValue()
|
||||||
if ln := len(val); ln != sha256.Size {
|
if ln := len(val); ln != sha256.Size {
|
||||||
return nil, errors.Errorf("could not convert %T to %T: invalid length %d",
|
return nil, errors.Errorf("could not convert %T to %T: invalid length %d",
|
||||||
|
|
Loading…
Reference in a new issue