Skip to content

Commit

Permalink
cleanup: clean identity expression
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorropo committed Jan 5, 2023
1 parent a20ddaa commit 4707f58
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ func (d *downloader) Read(b []byte) (int, error) {
pref := c.Prefix()
switch pref.MhType {
case mh.IDENTITY:
data = c.Hash()[1:] // skip the 0x00 prefix
data = data[len(data)-pref.MhLength:] // skip the multihash length
data = data[1+len(data)-pref.MhLength:] // skip the 0x00 prefix and the multihash length
default:
if err := verifcid.ValidateCid(c); err != nil {
return 0, fmt.Errorf("cid %s don't pass safe test: %w", cidStringTruncate(c), err)
Expand Down

0 comments on commit 4707f58

Please sign in to comment.