Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion non-standard/validators/notblank.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func NotBlank(fl validator.FieldLevel) bool {

switch field.Kind() {
case reflect.String:
return len(strings.TrimSpace(field.String())) > 0
return len(strings.Trim(strings.TrimSpace(field.String()), "\x1c\x1d\x1e\x1f")) > 0
case reflect.Chan, reflect.Map, reflect.Slice, reflect.Array:
return field.Len() > 0
case reflect.Ptr, reflect.Interface, reflect.Func:
Expand Down
4 changes: 2 additions & 2 deletions non-standard/validators/notblank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package validators
import (
"testing"

"github.com/go-playground/validator/v10"
"github.com/go-playground/assert/v2"
"github.com/go-playground/validator/v10"
)

type test struct {
Expand All @@ -24,7 +24,7 @@ func TestNotBlank(t *testing.T) {
// Errors
var x *int
invalid := test{
String: " ",
String: " \x1c\x1d\x1e\x1f\r\n",
Array: []int{},
Pointer: x,
Number: 0,
Expand Down