Skip to content

Commit 99cef89

Browse files
aschmahmanndjdv
authored andcommitted
fix path resolver to handle dagpb + unixfs
1 parent 7383a0d commit 99cef89

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ require (
5151
github.com/ipfs/go-log/v2 v2.5.1 // indirect
5252
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
5353
github.com/ipfs/go-unixfsnode v1.7.3
54-
github.com/ipld/go-codec-dagpb v1.6.0 // indirect
54+
github.com/ipld/go-codec-dagpb v1.6.0
5555
github.com/ipld/go-ipld-prime v0.20.0 // indirect
5656
github.com/jbenet/goprocess v0.1.4 // indirect
5757
github.com/klauspost/cpuid/v2 v2.2.5 // indirect

internal/filesystem/ipfs/resolve.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
blocks "github.com/ipfs/go-block-format"
1515
"github.com/ipfs/go-cid"
1616
"github.com/ipfs/go-unixfsnode"
17+
dagpb "github.com/ipld/go-codec-dagpb"
1718
)
1819

1920
type (
@@ -28,12 +29,13 @@ type (
2829

2930
func newPathResolver(api coreiface.CoreAPI) resolver.Resolver {
3031
var (
31-
blockstore = newCoreBlockStore(api.Block())
32-
fetcher = makeBlockFetcher(api.Dag())
33-
service = blockservice.New(blockstore, fetcher)
34-
config = bsfetcher.NewFetcherConfig(service)
35-
fetcherFactory = config.WithReifier(unixfsnode.Reify)
32+
blockstore = newCoreBlockStore(api.Block())
33+
fetcher = makeBlockFetcher(api.Dag())
34+
service = blockservice.New(blockstore, fetcher)
35+
config = bsfetcher.NewFetcherConfig(service)
3636
)
37+
config.PrototypeChooser = dagpb.AddSupportToChooser(config.PrototypeChooser)
38+
fetcherFactory := config.WithReifier(unixfsnode.Reify)
3739
return resolver.NewBasicResolver(fetcherFactory)
3840
}
3941

0 commit comments

Comments
 (0)