Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joi resolver crashes on File validation #668

Open
romanstetsyk opened this issue Mar 21, 2024 · 0 comments
Open

Joi resolver crashes on File validation #668

romanstetsyk opened this issue Mar 21, 2024 · 0 comments

Comments

@romanstetsyk
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant