Skip to content

Commit

Permalink
Perform some cleaning operations on line breaks. (kubernetes#11721)
Browse files Browse the repository at this point in the history
Co-authored-by: André Storfjord Kristiansen <[email protected]>
Co-authored-by: Jintao Zhang <[email protected]>
  • Loading branch information
3 people authored and krunalhinguu committed Aug 20, 2024
1 parent c5b16e4 commit 316e80c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions internal/ingress/controller/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ func cleanConf(in, out *bytes.Buffer) error {
case ' ', '\t':
needOutput = lineStarted
case '\r':
rest := in.Bytes()
if len(rest) > 0 {
if rest[0] != '\n' {
c = ' '
needOutput = lineStarted
}
}
case '\n':
needOutput = !(!lineStarted && emptyLineWritten)
nextLineStarted = false
Expand All @@ -150,6 +157,13 @@ func cleanConf(in, out *bytes.Buffer) error {
case stateComment:
switch c {
case '\r':
rest := in.Bytes()
if len(rest) > 0 {
if rest[0] != '\n' {
c = ' '
needOutput = lineStarted
}
}
case '\n':
needOutput = true
nextLineStarted = false
Expand Down

0 comments on commit 316e80c

Please sign in to comment.