Commit 36560d2b authored by Russ Cox's avatar Russ Cox

pem: print \n after 1 header line too

rearrange to make reason for if clear.

Fixes #911.

R=agl1
CC=golang-dev
https://golang.org/cl/1774044
parent ccd28e8e
......@@ -218,14 +218,13 @@ func Encode(out io.Writer, b *Block) (err os.Error) {
return
}
for k, v := range b.Headers {
_, err = out.Write([]byte(k + ": " + v + "\n"))
if err != nil {
return
if len(b.Headers) > 0 {
for k, v := range b.Headers {
_, err = out.Write([]byte(k + ": " + v + "\n"))
if err != nil {
return
}
}
}
if len(b.Headers) > 1 {
_, err = out.Write([]byte{'\n'})
if err != nil {
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment