Skip to content

Commit

Permalink
Fix file paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
lthibault committed Aug 5, 2024
1 parent c01b775 commit 9f05026
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Binary file modified examples/hello-world/main.wasm
Binary file not shown.
File renamed without changes.
14 changes: 8 additions & 6 deletions ww.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,23 @@ func (c Cluster) NewFS(ctx context.Context) (*system.FS, error) {
}, nil
}

func (c Cluster) Resolve(ctx context.Context, root path.Path) (n files.Node, err error) {
switch ns := root.Segments()[0]; ns {
case "ipld":
func (c Cluster) Resolve(ctx context.Context, p path.Path) (n files.Node, err error) {
switch ns := p.Segments()[0]; ns {
case "ipnsxs":
// IPLD introduces one level of indirection: a mutable name.
// Here we are fetching the IPFS record to which the name is
// currently pointing.
root, err = c.IPFS.Name().Resolve(ctx, root.String())
p, err = c.IPFS.Name().Resolve(ctx, p.String())
if err != nil {
return
}

default: // It's probably /ipfs/
default:
slog.Info("resolved namespace",
"ns", ns)
}

n, err = c.IPFS.Unixfs().Get(ctx, root)
n, err = c.IPFS.Unixfs().Get(ctx, p)
return
}

Expand Down

0 comments on commit 9f05026

Please sign in to comment.