Skip to content

Commit

Permalink
fix: newline should be considered displayable
Browse files Browse the repository at this point in the history
  • Loading branch information
cmitsakis committed May 25, 2022
1 parent 8273bc5 commit 0bc159e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ports/http/dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ func canDisplayAsString(b []byte) bool {
if json.Valid(b) {
return true
}
return isDisplayableString(string(b))
}

for _, rne := range string(b) {
if !unicode.IsGraphic(rne) {
func isDisplayableString(str string) bool {
for _, rne := range str {
if !unicode.IsGraphic(rne) && !unicode.IsSpace(rne) {
return false
}
}

return true
}

0 comments on commit 0bc159e

Please sign in to comment.