resolvers icon indicating copy to clipboard operation
resolvers copied to clipboard

`Joi` resolver crashes on `File` validation

Open romanstetsyk opened this issue 11 months ago • 0 comments

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:

  1. Go to the codesandbox below
  2. Drag any file to the upload area
  3. Click 'submit'
  4. 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 image

Desktop (please complete the following information):

  • OS: macOS
  • Browser chrome
  • Version 123

romanstetsyk avatar Mar 21 '24 19:03 romanstetsyk