From 7d95359c3e01c85d8fe394b1e24769353d74c6bf Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 26 Aug 2020 09:13:15 +0200 Subject: [PATCH 1/2] Fix #7624: Do not fetch dag nodes when checking if a pin exists --- core/coreapi/pin.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/coreapi/pin.go b/core/coreapi/pin.go index 5bd2f9d5af3..3b6ae2d9395 100644 --- a/core/coreapi/pin.go +++ b/core/coreapi/pin.go @@ -57,9 +57,9 @@ func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) (<-chan c } func (api *PinAPI) IsPinned(ctx context.Context, p path.Path, opts ...caopts.PinIsPinnedOption) (string, bool, error) { - dagNode, err := api.core().ResolveNode(ctx, p) + resolved, err := api.core().ResolvePath(ctx, p) if err != nil { - return "", false, fmt.Errorf("pin: %s", err) + return "", false, fmt.Errorf("error resolving path: %s", err) } settings, err := caopts.PinIsPinnedOptions(opts...) @@ -72,7 +72,7 @@ func (api *PinAPI) IsPinned(ctx context.Context, p path.Path, opts ...caopts.Pin return "", false, fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", settings.WithType) } - return api.pinning.IsPinnedWithType(ctx, dagNode.Cid(), mode) + return api.pinning.IsPinnedWithType(ctx, resolved.Cid(), mode) } // Rm pin rm api From 077e3e0648bfc4020c1ab5e0a092d9af607b3ea0 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Wed, 26 Aug 2020 14:08:56 -0400 Subject: [PATCH 2/2] chore: bump go-path --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index a07ac3ccc1a..414076c9306 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/ipfs/go-metrics-interface v0.0.1 github.com/ipfs/go-metrics-prometheus v0.0.2 github.com/ipfs/go-mfs v0.1.2 - github.com/ipfs/go-path v0.0.7 + github.com/ipfs/go-path v0.0.8 github.com/ipfs/go-unixfs v0.2.4 github.com/ipfs/go-verifcid v0.0.1 github.com/ipfs/interface-go-ipfs-core v0.4.0 diff --git a/go.sum b/go.sum index dbed6b79c8a..cd0dee3c102 100644 --- a/go.sum +++ b/go.sum @@ -443,6 +443,8 @@ github.com/ipfs/go-mfs v0.1.2/go.mod h1:T1QBiZPEpkPLzDqEJLNnbK55BVKVlNi2a+gVm4di github.com/ipfs/go-path v0.0.3/go.mod h1:zIRQUez3LuQIU25zFjC2hpBTHimWx7VK5bjZgRLbbdo= github.com/ipfs/go-path v0.0.7 h1:H06hKMquQ0aYtHiHryOMLpQC1qC3QwXwkahcEVD51Ho= github.com/ipfs/go-path v0.0.7/go.mod h1:6KTKmeRnBXgqrTvzFrPV3CamxcgvXX/4z79tfAd2Sno= +github.com/ipfs/go-path v0.0.8 h1:R0k6t9x/pa+g8qzl5apQIPurJFozXhopks3iw3MX+jU= +github.com/ipfs/go-path v0.0.8/go.mod h1:VpDkSBKQ9EFQOUgi54Tq/O/tGi8n1RfYNks13M3DEs8= github.com/ipfs/go-peertaskqueue v0.0.4/go.mod h1:03H8fhyeMfKNFWqzYEVyMbcPUeYrqP1MX6Kd+aN+rMQ= github.com/ipfs/go-peertaskqueue v0.1.0/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U= github.com/ipfs/go-peertaskqueue v0.1.1/go.mod h1:Jmk3IyCcfl1W3jTW3YpghSwSEC6IJ3Vzz/jUmWw8Z0U=