mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-22 02:47:48 +08:00
core/commands2: Fixed 'block' command for req.Files() API
This commit is contained in:
parent
3a9a62eb0e
commit
052d387ae5
@ -2,7 +2,6 @@ package commands
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"time"
|
||||
|
||||
@ -97,12 +96,17 @@ It reads from stdin, and <key> is a base58 encoded multihash.
|
||||
return nil, err
|
||||
}
|
||||
|
||||
in, ok := req.Arguments()[0].(io.Reader)
|
||||
if !ok {
|
||||
return nil, u.ErrCast()
|
||||
file, err := req.Files().NextFile()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadAll(in)
|
||||
data, err := ioutil.ReadAll(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = file.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user