asaskevich / govalidator

[Go] Package of validators and sanitizers for strings, numerics, slices and structs
MIT License
5.97k stars 554 forks source link

Empty string is a valid Base64 string #493

Open apelisse opened 10 months ago

apelisse commented 10 months ago
Q A
Documentation no
Bugfix yes
BC Break 🤷
New Feature no
RFC no
QA no

Description

Empty strings are valid base64 strings. If you base64 encode an empty string, you get an empty string. A few example:

A python example:

>>> import base64
>>> base64.b64decode("")
b''

If you don't want empty strings, you can change the minLength.