Commit 1c7a5d19 authored by Steven Allen's avatar Steven Allen

resolve: succeed on recursion limit when not recursing

Otherwise, non-recursive resolution is pretty much useless.

License: MIT
Signed-off-by: default avatarSteven Allen <steven@stebalien.com>
parent fded3bc0
......@@ -71,10 +71,7 @@ The resolver can recursively resolve:
}
output, err := resolver.Resolve(req.Context, name, ropts...)
if err == namesys.ErrResolveFailed {
return err
}
if err != nil {
if err != nil && (recursive || err != namesys.ErrResolveRecursion) {
return err
}
return cmds.EmitOnce(res, &ncmd.ResolvedPath{Path: output})
......
......@@ -8,6 +8,7 @@ import (
"time"
cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
namesys "github.com/ipfs/go-ipfs/namesys"
cmdkit "github.com/ipfs/go-ipfs-cmdkit"
cmds "github.com/ipfs/go-ipfs-cmds"
......@@ -130,7 +131,7 @@ Resolve the value of a dnslink:
if !stream {
output, err := api.Name().Resolve(req.Context, name, opts...)
if err != nil {
if err != nil && (recursive || err != namesys.ErrResolveRecursion) {
return err
}
......@@ -143,8 +144,8 @@ Resolve the value of a dnslink:
}
for v := range output {
if v.Err != nil {
return err
if v.Err != nil && (recursive || v.Err != namesys.ErrResolveRecursion) {
return v.Err
}
if err := res.Emit(&ResolvedPath{path.FromString(v.Path.String())}); err != nil {
return err
......
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