Skip to content

Commit

Permalink
fix: make get match non-pointer cidlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Oct 21, 2021
1 parent 4cbd883 commit 28f1c80
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/car/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func GetCarDag(c *cli.Context) error {
ls := cidlink.DefaultLinkSystem()
ls.TrustedStorage = true
ls.StorageReadOpener = func(_ linking.LinkContext, l datamodel.Link) (io.Reader, error) {
if cl, ok := l.(*cidlink.Link); ok {
if cl, ok := l.(cidlink.Link); ok {
blk, err := bs.Get(cl.Cid)
if err != nil {
if err == ipfsbs.ErrNotFound {
Expand All @@ -105,7 +105,7 @@ func GetCarDag(c *cli.Context) error {
ls.StorageWriteOpener = func(_ linking.LinkContext) (io.Writer, linking.BlockWriteCommitter, error) {
buf := bytes.NewBuffer(nil)
return buf, func(l datamodel.Link) error {
if cl, ok := l.(*cidlink.Link); ok {
if cl, ok := l.(cidlink.Link); ok {
blk, err := blocks.NewBlockWithCid(buf.Bytes(), cl.Cid)
if err != nil {
return err
Expand Down Expand Up @@ -142,7 +142,7 @@ func GetCarDag(c *cli.Context) error {
}
err = traversal.WalkMatching(node, s, func(p traversal.Progress, n datamodel.Node) error {
if p.LastBlock.Link != nil {
if cl, ok := p.LastBlock.Link.(*cidlink.Link); ok {
if cl, ok := p.LastBlock.Link.(cidlink.Link); ok {
lnkProto = cidlink.LinkPrototype{
Prefix: cl.Prefix(),
}
Expand Down

0 comments on commit 28f1c80

Please sign in to comment.