resolvers
resolvers copied to clipboard
`Joi` resolver crashes on `File` validation
Describe the bug
The validator crashed while trying to validate a File upload with an error Cannot read properties of undefined (reading 'length')
.
The schema like this works fine:
const file = Joi.object<File>().label("File");
But as soon as I try to add the fields to validate it crashes.
const file = Joi.object<File>({
name: Joi.string().max(255).required(),
}).label("File");
To Reproduce Steps to reproduce the behavior:
- Go to the codesandbox below
- Drag any file to the upload area
- Click 'submit'
- See error
Codesandbox link (Required)
https://codesandbox.io/p/sandbox/joi-error-hcktkx?file=%2Fsrc%2FApp.tsx%3A19%2C42
Expected behavior Such an error should not appear.
Screenshots
Desktop (please complete the following information):
- OS: macOS
- Browser chrome
- Version 123