Fix #7624: Do not fetch dag nodes when checking if a pin exists
Hector Sanjuan committed
Aug 26, 2020 at 09:13 UTC
7d95359c3e01c85d8fe394b1e24769353d74c6bf
1 file changed
+3
-3
core/coreapi/pin.go
+3
-3
@@ -57,9 +57,9 @@ func (api *PinAPI) Ls(ctx context.Context, opts ...caopts.PinLsOption) (<-chan c
57
}
58
59
func (api *PinAPI) IsPinned(ctx context.Context, p path.Path, opts ...caopts.PinIsPinnedOption) (string, bool, error) {
60
- dagNode, err := api.core().ResolveNode(ctx, p)
60
+ resolved, err := api.core().ResolvePath(ctx, p)
61
if err != nil {
62
- return "", false, fmt.Errorf("pin: %s", err)
62
+ return "", false, fmt.Errorf("error resolving path: %s", err)
63
}
64
65
settings, err := caopts.PinIsPinnedOptions(opts...)
@@ -72,7 +72,7 @@ func (api *PinAPI) IsPinned(ctx context.Context, p path.Path, opts ...caopts.Pin
72
return "", false, fmt.Errorf("invalid type '%s', must be one of {direct, indirect, recursive, all}", settings.WithType)
73
}
74
75
- return api.pinning.IsPinnedWithType(ctx, dagNode.Cid(), mode)
75
+ return api.pinning.IsPinnedWithType(ctx, resolved.Cid(), mode)
76
}
77
78
// Rm pin rm api