Skip to content

Commit

Permalink
Also check hash type in 'tryOtherCidVersion'.
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Kevin Atkinson <[email protected]>
  • Loading branch information
kevina committed Aug 7, 2018
1 parent e7ca955 commit 877fa90
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion thirdparty/cidv0v1/blockstore.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cidv0v1

import (
mh "gx/ipfs/QmPnFwZ2JXKnXgMw8CdBPxn7FWh6LLdjUjxV1fKHuJnkr8/go-multihash"
blocks "gx/ipfs/QmVzK524a2VWLqyvtBeiHKsUAWYgeAk4DBeZoY7vpNPNRx/go-block-format"
cid "gx/ipfs/QmYVNvtQkeZ6AKSwDrjQTs432QtL6umrrK41EBq3cu7iSP/go-cid"
bs "gx/ipfs/QmadMhXJLHMFjpRmh85XjpmVDkEtQpNYEZNRpWRvYVLrvb/go-ipfs-blockstore"
Expand Down Expand Up @@ -58,7 +59,7 @@ func (b *blockstore) Get(c *cid.Cid) (blocks.Block, error) {

func tryOtherCidVersion(c *cid.Cid) *cid.Cid {
prefix := c.Prefix()
if prefix.Codec != cid.DagProtobuf {
if prefix.Codec != cid.DagProtobuf || prefix.MhType != mh.SHA2_256 || prefix.MhLength != 32 {
return nil
}
var c1 *cid.Cid
Expand Down

0 comments on commit 877fa90

Please sign in to comment.