mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-25 23:21:54 +08:00
Fix resolving links in sharded directories on gateway
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user