Skip to content

Commit

Permalink
Fix #7624: Do not fetch dag nodes when checking if a pin exists
Browse files Browse the repository at this point in the history
  • Loading branch information
hsanjuan committed Aug 26, 2020
1 parent 45e574b commit 7d95359
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/coreapi/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand All @@ -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
Expand Down

0 comments on commit 7d95359

Please sign in to comment.