Fix isPrintable helper

This commit is contained in:
Ken Hibino 2021-06-02 06:25:37 -07:00
parent d58d549d4c
commit 403062b556

View File

@ -171,12 +171,16 @@ func isPrintable(data []byte) bool {
if !utf8.Valid(data) { if !utf8.Valid(data) {
return false return false
} }
isAllSpace := true
for _, r := range string(data) { for _, r := range string(data) {
if !unicode.IsPrint(r) { if !unicode.IsPrint(r) {
return false return false
} }
if !unicode.IsSpace(r) {
isAllSpace = false
}
} }
return true return !isAllSpace
} }
func toPrintablePayload(payload []byte) string { func toPrintablePayload(payload []byte) string {