Commit 052d387a authored by Matt Bell's avatar Matt Bell

core/commands2: Fixed 'block' command for req.Files() API

parent 3a9a62eb
...@@ -2,7 +2,6 @@ package commands ...@@ -2,7 +2,6 @@ package commands
import ( import (
"bytes" "bytes"
"io"
"io/ioutil" "io/ioutil"
"time" "time"
...@@ -97,12 +96,17 @@ It reads from stdin, and <key> is a base58 encoded multihash. ...@@ -97,12 +96,17 @@ It reads from stdin, and <key> is a base58 encoded multihash.
return nil, err return nil, err
} }
in, ok := req.Arguments()[0].(io.Reader) file, err := req.Files().NextFile()
if !ok { if err != nil {
return nil, u.ErrCast() return nil, err
}
data, err := ioutil.ReadAll(file)
if err != nil {
return nil, err
} }
data, err := ioutil.ReadAll(in) err = file.Close()
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment