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
djdv committed
Sep 12, 2025 at 19:16 UTC
38be7908b6d15cde3a9e884ba57fc35c16e78419
1 file changed
+2
-1
client/rpc/pin.go
+2
-1
@@ -72,6 +72,7 @@ func (api *PinAPI) Ls(ctx context.Context, pins chan<- iface.Pin, opts ...caopts
72
73
res, err := api.core().Request("pin/ls").
74
Option("type", options.Type).
75
+ Option("names", options.Detailed).
76
Option("stream", true).
77
Send(ctx)
78
if err != nil {
@@ -80,8 +81,8 @@ func (api *PinAPI) Ls(ctx context.Context, pins chan<- iface.Pin, opts ...caopts
81
defer res.Output.Close()
82
83
dec := json.NewDecoder(res.Output)
83
- var out pinLsObject
84
for {
85
+ var out pinLsObject
86
err := dec.Decode(&out)
87
if err != nil {
88
if err != io.EOF {