mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
rpc: retreive pin names when Detailed option provided (#10966)
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Check / lint (push) Has been cancelled
Docker Check / build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
Some checks failed
CodeQL / codeql (push) Has been cancelled
Docker Check / lint (push) Has been cancelled
Docker Check / build (push) Has been cancelled
Gateway Conformance / gateway-conformance (push) Has been cancelled
Gateway Conformance / gateway-conformance-libp2p-experiment (push) Has been cancelled
Go Build / go-build (push) Has been cancelled
Go Check / go-check (push) Has been cancelled
Go Lint / go-lint (push) Has been cancelled
Go Test / go-test (push) Has been cancelled
Interop / interop-prep (push) Has been cancelled
Sharness / sharness-test (push) Has been cancelled
Spell Check / spellcheck (push) Has been cancelled
Interop / helia-interop (push) Has been cancelled
Interop / ipfs-webui (push) Has been cancelled
* 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
This commit is contained in:
parent
20f8151628
commit
38be7908b6
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user