From 052d387ae54cfefdee8bf5fb4018841d8f1a03c3 Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Sun, 16 Nov 2014 00:49:44 -0800 Subject: [PATCH] core/commands2: Fixed 'block' command for req.Files() API --- core/commands2/block.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/core/commands2/block.go b/core/commands2/block.go index 3e1186705..a8cf2b923 100644 --- a/core/commands2/block.go +++ b/core/commands2/block.go @@ -2,7 +2,6 @@ package commands import ( "bytes" - "io" "io/ioutil" "time" @@ -97,12 +96,17 @@ It reads from stdin, and 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 }