Skip to content

Commit

Permalink
gateway: NoFetchGateway should use resolver with offline-blockservice…
Browse files Browse the repository at this point in the history
… fetcher
  • Loading branch information
hsanjuan committed Oct 25, 2023
1 parent 9f4fefe commit b4b7ca7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/corehttp/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ func newGatewayBackend(n *core.IpfsNode) (gateway.IPFSBackend, error) {
bserv := n.Blocks
var vsRouting routing.ValueStore = n.Routing
nsys := n.Namesys
resolver := n.UnixFSPathResolver

if cfg.Gateway.NoFetch {
bserv = blockservice.New(bserv.Blockstore(), offline.Exchange(bserv.Blockstore()))

Expand All @@ -130,12 +132,16 @@ func newGatewayBackend(n *core.IpfsNode) (gateway.IPFSBackend, error) {
if err != nil {
return nil, fmt.Errorf("error constructing namesys: %w", err)
}

// Let NewBlocksBackend setup the default resolver using the
// offline backend.
resolver = nil

Check warning on line 138 in core/corehttp/gateway.go

View check run for this annotation

Codecov / codecov/patch

core/corehttp/gateway.go#L138

Added line #L138 was not covered by tests
}

backend, err := gateway.NewBlocksBackend(bserv,
gateway.WithValueStore(vsRouting),
gateway.WithNameSystem(nsys),
gateway.WithResolver(n.UnixFSPathResolver),
gateway.WithResolver(resolver),
)
if err != nil {
return nil, err
Expand Down

0 comments on commit b4b7ca7

Please sign in to comment.