mirror of
https://github.com/astaxie/beego.git
synced 2025-07-10 02:30:18 +00:00
Merge pull request #2365 from chesedo/RequiredValidationCatchSpaces
[WIP]Have Required validator trim strings to fix #2361
This commit is contained in:
@ -18,6 +18,7 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
)
|
||||
@ -98,7 +99,7 @@ func (r Required) IsSatisfied(obj interface{}) bool {
|
||||
}
|
||||
|
||||
if str, ok := obj.(string); ok {
|
||||
return len(str) > 0
|
||||
return len(strings.TrimSpace(str)) > 0
|
||||
}
|
||||
if _, ok := obj.(bool); ok {
|
||||
return true
|
||||
|
Reference in New Issue
Block a user