Skip to content

Commit

Permalink
Remove an empty line for /pki/ca_chain (#5779)
Browse files Browse the repository at this point in the history
This PR fix #5778.

Easy test case to reproduce the problem:
https://play.golang.org/p/CAMdrOHT7C1

Since `certStr` is empty string during first iteration `strings.Join()`
will merge empty line with first CA cert.

Extra `strings.TrimSpace` call will remove that empty line, before
certificate will be return.
  • Loading branch information
ljagiello authored and jefferai committed Dec 12, 2018
1 parent b701df4 commit 6dc872c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/logical/pki/path_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (b *backend) pathFetchRead(ctx context.Context, req *logical.Request, data
}
certStr = strings.Join([]string{certStr, strings.TrimSpace(string(pem.EncodeToMemory(&block)))}, "\n")
}
certificate = []byte(certStr)
certificate = []byte(strings.TrimSpace(certStr))
goto reply
}

Expand Down

0 comments on commit 6dc872c

Please sign in to comment.