fix: ensure we actually have a full cid
This commit is contained in:
parent
7fa2e6adac
commit
9b464e0932
|
@ -279,6 +279,10 @@ func initCID(bytes []byte) (*CID, error) {
|
|||
return NewCID(cidType, *hash, 0), nil
|
||||
}
|
||||
|
||||
if len(bytes) < 34 {
|
||||
return nil, errors.New("invalid cid")
|
||||
}
|
||||
|
||||
hashBytes := bytes[1:34]
|
||||
hash := NewMultihash(hashBytes)
|
||||
|
||||
|
|
Loading…
Reference in New Issue