From 38be7908b6d15cde3a9e884ba57fc35c16e78419 Mon Sep 17 00:00:00 2001 From: djdv Date: Fri, 12 Sep 2025 19:16:36 -0400 Subject: [PATCH] rpc: retreive pin names when Detailed option provided (#10966) * rpc: don't reuse object during decode Retaining the object during the loop will make fields such as `Name` stick between iterations. This patch decodes into a new struct each iteration, assuring we don't retain values from other pins. * rpc: use the Detailed option during request --- client/rpc/pin.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/rpc/pin.go b/client/rpc/pin.go index 2b1ef8258..f959728b1 100644 --- a/client/rpc/pin.go +++ b/client/rpc/pin.go @@ -72,6 +72,7 @@ func (api *PinAPI) Ls(ctx context.Context, pins chan<- iface.Pin, opts ...caopts res, err := api.core().Request("pin/ls"). Option("type", options.Type). + Option("names", options.Detailed). Option("stream", true). Send(ctx) if err != nil { @@ -80,8 +81,8 @@ func (api *PinAPI) Ls(ctx context.Context, pins chan<- iface.Pin, opts ...caopts defer res.Output.Close() dec := json.NewDecoder(res.Output) - var out pinLsObject for { + var out pinLsObject err := dec.Decode(&out) if err != nil { if err != io.EOF {