From 0bc159e6969c0ac7e17ecb9ba410e9ff0edeee63 Mon Sep 17 00:00:00 2001 From: Charalampos Mitsakis Date: Wed, 25 May 2022 17:00:01 +0300 Subject: [PATCH] fix: newline should be considered displayable --- ports/http/dto.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ports/http/dto.go b/ports/http/dto.go index ab00664..d485625 100644 --- a/ports/http/dto.go +++ b/ports/http/dto.go @@ -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 }