mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] update latest deps, ensure readme up to date (#1873)
* [chore] update latest deps, ensure readme up to date * remove double entry
This commit is contained in:
32
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
32
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
@ -1414,25 +1414,21 @@ func isURL(fl FieldLevel) bool {
|
||||
switch field.Kind() {
|
||||
case reflect.String:
|
||||
|
||||
var i int
|
||||
s := field.String()
|
||||
|
||||
// checks needed as of Go 1.6 because of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195
|
||||
// emulate browser and strip the '#' suffix prior to validation. see issue-#237
|
||||
if i = strings.Index(s, "#"); i > -1 {
|
||||
s = s[:i]
|
||||
}
|
||||
|
||||
if len(s) == 0 {
|
||||
return false
|
||||
}
|
||||
|
||||
url, err := url.ParseRequestURI(s)
|
||||
|
||||
url, err := url.Parse(s)
|
||||
if err != nil || url.Scheme == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
if url.Host == "" && url.Fragment == "" && url.Opaque == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -1450,7 +1446,13 @@ func isHttpURL(fl FieldLevel) bool {
|
||||
case reflect.String:
|
||||
|
||||
s := strings.ToLower(field.String())
|
||||
return strings.HasPrefix(s, "http://") || strings.HasPrefix(s, "https://")
|
||||
|
||||
url, err := url.Parse(s)
|
||||
if err != nil || url.Host == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
return url.Scheme == "http" || url.Scheme == "https"
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
@ -2568,9 +2570,17 @@ func isDirPath(fl FieldLevel) bool {
|
||||
func isJSON(fl FieldLevel) bool {
|
||||
field := fl.Field()
|
||||
|
||||
if field.Kind() == reflect.String {
|
||||
switch field.Kind() {
|
||||
case reflect.String:
|
||||
val := field.String()
|
||||
return json.Valid([]byte(val))
|
||||
case reflect.Slice:
|
||||
fieldType := field.Type()
|
||||
|
||||
if fieldType.ConvertibleTo(byteSliceType) {
|
||||
b := field.Convert(byteSliceType).Interface().([]byte)
|
||||
return json.Valid(b)
|
||||
}
|
||||
}
|
||||
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
|
Reference in New Issue
Block a user