cli: Trim spaces from token file
This commit is contained in:
		
							parent
							
								
									495554e565
								
							
						
					
					
						commit
						f1ccbe496a
					
				| @ -1,9 +1,9 @@ | |||||||
| package repo | package repo | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
|  | 	"bytes" | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
| 	"github.com/filecoin-project/sector-storage/stores" |  | ||||||
| 	"io" | 	"io" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"os" | 	"os" | ||||||
| @ -21,6 +21,8 @@ import ( | |||||||
| 	"github.com/multiformats/go-multiaddr" | 	"github.com/multiformats/go-multiaddr" | ||||||
| 	"golang.org/x/xerrors" | 	"golang.org/x/xerrors" | ||||||
| 
 | 
 | ||||||
|  | 	"github.com/filecoin-project/sector-storage/stores" | ||||||
|  | 
 | ||||||
| 	"github.com/filecoin-project/lotus/chain/types" | 	"github.com/filecoin-project/lotus/chain/types" | ||||||
| 	"github.com/filecoin-project/lotus/node/config" | 	"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
 | 	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
 | // Lock acquires exclusive lock on this repo
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user