From 02afd7d71f1205c57fc68053f978ba5aaa746368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Wed, 27 May 2020 10:13:06 +0200 Subject: [PATCH] cli: Trim spaces from token file --- node/repo/fsrepo.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/node/repo/fsrepo.go b/node/repo/fsrepo.go index 322adbdef..396fbf67e 100644 --- a/node/repo/fsrepo.go +++ b/node/repo/fsrepo.go @@ -1,9 +1,9 @@ package repo import ( + "bytes" "encoding/json" "fmt" - "github.com/filecoin-project/sector-storage/stores" "io" "io/ioutil" "os" @@ -21,6 +21,8 @@ import ( "github.com/multiformats/go-multiaddr" "golang.org/x/xerrors" + "github.com/filecoin-project/sector-storage/stores" + "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/node/config" ) @@ -191,7 +193,12 @@ func (fsr *FsRepo) APIToken() ([]byte, error) { } defer f.Close() //nolint: errcheck // Read only op - return ioutil.ReadAll(f) + tb, err := ioutil.ReadAll(f) + if err != nil { + return nil, err + } + + return bytes.TrimSpace(tb), nil } // Lock acquires exclusive lock on this repo