Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
fix(print): remove infinite recursion in formatValue fn (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlittle authored Apr 4, 2019
1 parent 6dcc97e commit be3f575
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/printer/printer.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,14 @@ func formatValue(value string, indentLength int) string {

return formattedValue
} else if decodedString, err := base64.StdEncoding.DecodeString(value); err == nil && isASCII(decodedString) {
// 4 (attribute padding) + 1 (key/value space separation) + 1 (opening quote for value ")
multiIdentLength := indentLength + 4 + 1 + 1

newlineReplacement := fmt.Sprintf("\n%s", strings.Repeat(" ", multiIdentLength))

formattedValue := strings.Replace(string(decodedString), "\n", newlineReplacement, -1)

return formatValue(string(decodedString), indentLength)
return formattedValue
}

return value
Expand Down

0 comments on commit be3f575

Please sign in to comment.