Skip to content

Commit 604993b

Browse files
committed
ipfs: disambiguate path resolver's error kinds
Without this we'll default to returning an IO error, which breaks some programs that would otherwise expect/handle a "not found" error kind.
1 parent a4e8c5c commit 604993b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/filesystem/ipfs/shared.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
dag "github.com/ipfs/boxo/ipld/merkledag"
1616
"github.com/ipfs/boxo/ipld/unixfs"
1717
unixpb "github.com/ipfs/boxo/ipld/unixfs/pb"
18+
"github.com/ipfs/boxo/path/resolver"
1819
ipfscmds "github.com/ipfs/go-ipfs-cmds"
1920
cbor "github.com/ipfs/go-ipld-cbor"
2021
ipld "github.com/ipfs/go-ipld-format"
@@ -257,6 +258,10 @@ func cidErrKind(err error) fserrors.Kind {
257258
}
258259

259260
func resolveErrKind(err error) fserrors.Kind {
261+
var resolveErr resolver.ErrNoLink
262+
if errors.As(err, &resolveErr) {
263+
return fserrors.NotExist
264+
}
260265
// XXX: Upstream doesn't define error values
261266
// to compare against. We have to fallback to strings.
262267
// This could break at any time.

0 commit comments

Comments
 (0)