Commit 772deca3 authored by Łukasz Magiera's avatar Łukasz Magiera

Fix resolving links in sharded directories on gateway

License: MIT
Signed-off-by: default avatarŁukasz Magiera <magik6k@gmail.com>
parent 1dede1b1
......@@ -69,19 +69,25 @@ func (r *Resolver) ResolveToLastNode(ctx context.Context, fpath path.Path) (ipld
}
for len(p) > 0 {
val, rest, err := nd.Resolve(p)
lnk, rest, err := r.ResolveOnce(ctx, r.DAG, nd, p)
if err != nil {
return nil, nil, err
}
switch val := val.(type) {
case *ipld.Link:
next, err := val.GetNode(ctx, r.DAG)
if lnk != nil {
next, err := lnk.GetNode(ctx, r.DAG)
if err != nil {
return nil, nil, err
}
nd = next
p = rest
continue
}
val, rest, err := nd.Resolve(p)
switch val.(type) {
case *ipld.Link:
return nil, nil, errors.New("inconsistent ResolveOnce / nd.Resolve")
default:
return nd, p, nil
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment