satisfy linter, use Prefix for common path of non inline CIDs
This commit is contained in:
parent
8a55b73146
commit
2ff5aec80e
@ -22,12 +22,16 @@ func NewIDStore(bs Blockstore) Blockstore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func decodeCid(cid cid.Cid) (inline bool, data []byte, err error) {
|
func decodeCid(cid cid.Cid) (inline bool, data []byte, err error) {
|
||||||
|
if cid.Prefix().MhType != mh.IDENTITY {
|
||||||
|
return false, nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
dmh, err := mh.Decode(cid.Hash())
|
dmh, err := mh.Decode(cid.Hash())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if dmh.Code == mh.ID {
|
if dmh.Code == mh.IDENTITY {
|
||||||
return true, dmh.Digest, nil
|
return true, dmh.Digest, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user