cmd/swarm: trim new lines from files

This commit is contained in:
Anton Evangelatov 2018-09-28 14:38:05 +02:00
parent 2c110c81ee
commit d5837e84ff

View File

@ -130,7 +130,7 @@ func accessNewACT(ctx *cli.Context) {
if err != nil { if err != nil {
utils.Fatalf("had an error reading the grantee public key list") utils.Fatalf("had an error reading the grantee public key list")
} }
pkGrantees = strings.Split(string(bytes), "\n") pkGrantees = strings.Split(strings.Trim(string(bytes), "\n"), "\n")
} }
if passGranteesFilename != "" { if passGranteesFilename != "" {
@ -138,7 +138,7 @@ func accessNewACT(ctx *cli.Context) {
if err != nil { if err != nil {
utils.Fatalf("could not read password filename: %v", err) utils.Fatalf("could not read password filename: %v", err)
} }
passGrantees = strings.Split(string(bytes), "\n") passGrantees = strings.Split(strings.Trim(string(bytes), "\n"), "\n")
} }
accessKey, ae, actManifest, err = api.DoACT(ctx, privateKey, salt, pkGrantees, passGrantees) accessKey, ae, actManifest, err = api.DoACT(ctx, privateKey, salt, pkGrantees, passGrantees)
if err != nil { if err != nil {