mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore]: Bump github.com/go-playground/validator/v10 (#1812)
Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.13.0 to 10.14.0. - [Release notes](https://github.com/go-playground/validator/releases) - [Commits](https://github.com/go-playground/validator/compare/v10.13.0...v10.14.0) --- updated-dependencies: - dependency-name: github.com/go-playground/validator/v10 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
1
vendor/github.com/go-playground/validator/v10/.gitignore
generated
vendored
1
vendor/github.com/go-playground/validator/v10/.gitignore
generated
vendored
@ -26,6 +26,7 @@ _testmain.go
|
||||
*.test
|
||||
*.out
|
||||
*.txt
|
||||
/**/*.DS_Store
|
||||
cover.html
|
||||
README.html
|
||||
.idea
|
||||
|
3
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
3
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
@ -1,7 +1,7 @@
|
||||
Package validator
|
||||
=================
|
||||
<img align="right" src="https://raw.githubusercontent.com/go-playground/validator/v10/logo.png">[](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||

|
||||

|
||||
[](https://travis-ci.org/go-playground/validator)
|
||||
[](https://coveralls.io/github/go-playground/validator?branch=master)
|
||||
[](https://goreportcard.com/report/github.com/go-playground/validator)
|
||||
@ -228,6 +228,7 @@ Baked-in Validations
|
||||
| dirpath | Directory Path |
|
||||
| file | Existing File |
|
||||
| filepath | File Path |
|
||||
| image | Image |
|
||||
| isdefault | Is Default |
|
||||
| len | Length |
|
||||
| max | Maximum |
|
||||
|
63
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
63
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
@ -22,6 +22,7 @@ import (
|
||||
"golang.org/x/crypto/sha3"
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/gabriel-vasile/mimetype"
|
||||
"github.com/leodido/go-urn"
|
||||
)
|
||||
|
||||
@ -144,6 +145,7 @@ var (
|
||||
"endswith": endsWith,
|
||||
"startsnotwith": startsNotWith,
|
||||
"endsnotwith": endsNotWith,
|
||||
"image": isImage,
|
||||
"isbn": isISBN,
|
||||
"isbn10": isISBN10,
|
||||
"isbn13": isISBN13,
|
||||
@ -1488,6 +1490,67 @@ func isFile(fl FieldLevel) bool {
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
}
|
||||
|
||||
// isImage is the validation function for validating if the current field's value contains the path to a valid image file
|
||||
func isImage(fl FieldLevel) bool {
|
||||
mimetypes := map[string]bool{
|
||||
"image/bmp": true,
|
||||
"image/cis-cod": true,
|
||||
"image/gif": true,
|
||||
"image/ief": true,
|
||||
"image/jpeg": true,
|
||||
"image/jp2": true,
|
||||
"image/jpx": true,
|
||||
"image/jpm": true,
|
||||
"image/pipeg": true,
|
||||
"image/png": true,
|
||||
"image/svg+xml": true,
|
||||
"image/tiff": true,
|
||||
"image/webp": true,
|
||||
"image/x-cmu-raster": true,
|
||||
"image/x-cmx": true,
|
||||
"image/x-icon": true,
|
||||
"image/x-portable-anymap": true,
|
||||
"image/x-portable-bitmap": true,
|
||||
"image/x-portable-graymap": true,
|
||||
"image/x-portable-pixmap": true,
|
||||
"image/x-rgb": true,
|
||||
"image/x-xbitmap": true,
|
||||
"image/x-xpixmap": true,
|
||||
"image/x-xwindowdump": true,
|
||||
}
|
||||
field := fl.Field()
|
||||
|
||||
switch field.Kind() {
|
||||
case reflect.String:
|
||||
filePath := field.String()
|
||||
fileInfo, err := os.Stat(filePath)
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if fileInfo.IsDir() {
|
||||
return false
|
||||
}
|
||||
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
mime, err := mimetype.DetectReader(file)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
if _, ok := mimetypes[mime.String()]; ok {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// isFilePath is the validation function for validating if the current field's value is a valid file path.
|
||||
func isFilePath(fl FieldLevel) bool {
|
||||
|
||||
|
2
vendor/github.com/go-playground/validator/v10/country_codes.go
generated
vendored
2
vendor/github.com/go-playground/validator/v10/country_codes.go
generated
vendored
@ -1135,7 +1135,7 @@ var iso3166_2 = map[string]bool{
|
||||
"VN-69": true, "VN-70": true, "VN-71": true, "VN-72": true, "VN-73": true,
|
||||
"VN-CT": true, "VN-DN": true, "VN-HN": true, "VN-HP": true, "VN-SG": true,
|
||||
"VU-MAP": true, "VU-PAM": true, "VU-SAM": true, "VU-SEE": true, "VU-TAE": true,
|
||||
"VU-TOB": true, "WF-SG": true,"WF-UV": true, "WS-AA": true, "WS-AL": true, "WS-AT": true, "WS-FA": true,
|
||||
"VU-TOB": true, "WF-SG": true, "WF-UV": true, "WS-AA": true, "WS-AL": true, "WS-AT": true, "WS-FA": true,
|
||||
"WS-GE": true, "WS-GI": true, "WS-PA": true, "WS-SA": true, "WS-TU": true,
|
||||
"WS-VF": true, "WS-VS": true, "YE-AB": true, "YE-AD": true, "YE-AM": true,
|
||||
"YE-BA": true, "YE-DA": true, "YE-DH": true, "YE-HD": true, "YE-HJ": true, "YE-HU": true,
|
||||
|
25
vendor/github.com/go-playground/validator/v10/doc.go
generated
vendored
25
vendor/github.com/go-playground/validator/v10/doc.go
generated
vendored
@ -863,7 +863,6 @@ This validates that a string value is a valid JWT
|
||||
|
||||
Usage: jwt
|
||||
|
||||
|
||||
# File
|
||||
|
||||
This validates that a string value contains a valid file path and that
|
||||
@ -872,6 +871,15 @@ This is done using os.Stat, which is a platform independent function.
|
||||
|
||||
Usage: file
|
||||
|
||||
# Image path
|
||||
|
||||
This validates that a string value contains a valid file path and that
|
||||
the file exists on the machine and is an image.
|
||||
This is done using os.Stat and github.com/gabriel-vasile/mimetype
|
||||
|
||||
Usage: image
|
||||
|
||||
# URL String
|
||||
|
||||
# File Path
|
||||
|
||||
@ -881,7 +889,6 @@ This is done using os.Stat, which is a platform independent function.
|
||||
|
||||
Usage: filepath
|
||||
|
||||
|
||||
# URL String
|
||||
|
||||
This validates that a string value contains a valid url
|
||||
@ -923,7 +930,6 @@ you can use this with the omitempty tag.
|
||||
|
||||
Usage: base64url
|
||||
|
||||
|
||||
# Base64RawURL String
|
||||
|
||||
This validates that a string value contains a valid base64 URL safe value,
|
||||
@ -934,7 +940,6 @@ you can use this with the omitempty tag.
|
||||
|
||||
Usage: base64url
|
||||
|
||||
|
||||
# Bitcoin Address
|
||||
|
||||
This validates that a string value contains a valid bitcoin address.
|
||||
@ -1267,7 +1272,6 @@ This is done using os.Stat, which is a platform independent function.
|
||||
|
||||
Usage: dir
|
||||
|
||||
|
||||
# Directory Path
|
||||
|
||||
This validates that a string value contains a valid directory but does
|
||||
@ -1278,7 +1282,6 @@ may not exist at the time of validation.
|
||||
|
||||
Usage: dirpath
|
||||
|
||||
|
||||
# HostPort
|
||||
|
||||
This validates that a string value contains a valid DNS hostname and port that
|
||||
@ -1350,7 +1353,6 @@ More information on https://semver.org/
|
||||
|
||||
Usage: semver
|
||||
|
||||
|
||||
# CVE Identifier
|
||||
|
||||
This validates that a string value is a valid cve id, defined in cve mitre.
|
||||
@ -1358,17 +1360,15 @@ More information on https://cve.mitre.org/
|
||||
|
||||
Usage: cve
|
||||
|
||||
|
||||
# Credit Card
|
||||
|
||||
This validates that a string value contains a valid credit card number using Luhn algorithm.
|
||||
|
||||
Usage: credit_card
|
||||
|
||||
|
||||
# Luhn Checksum
|
||||
|
||||
Usage: luhn_checksum
|
||||
Usage: luhn_checksum
|
||||
|
||||
This validates that a string or (u)int value contains a valid checksum using the Luhn algorithm.
|
||||
|
||||
@ -1376,8 +1376,7 @@ This validates that a string or (u)int value contains a valid checksum using the
|
||||
|
||||
This validates that a string is a valid 24 character hexadecimal string.
|
||||
|
||||
Usage: mongodb
|
||||
|
||||
Usage: mongodb
|
||||
|
||||
# Cron
|
||||
|
||||
@ -1385,7 +1384,7 @@ This validates that a string value contains a valid cron expression.
|
||||
|
||||
Usage: cron
|
||||
|
||||
Alias Validators and Tags
|
||||
# Alias Validators and Tags
|
||||
|
||||
Alias Validators and Tags
|
||||
NOTE: When returning an error, the tag returned in "FieldError" will be
|
||||
|
Reference in New Issue
Block a user