Skip to content

Commit 9563042

Browse files
committed
conform coerce empty file now
1 parent 8b501dc commit 9563042

File tree

1 file changed

+1
-5
lines changed
  • exercises/04.file-upload/02.problem.file-validation

1 file changed

+1
-5
lines changed

exercises/04.file-upload/02.problem.file-validation/README.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ a snippet from that example:
2121

2222
```tsx
2323
const schema = z.object({
24-
profile: z
25-
.instanceof(File)
26-
// When browser constructs a form data from an empty file input, a default file
27-
// entry would be created. we can validate this by checking the filename and size.
28-
.refine(file => file.name !== '' && file.size !== 0, 'Profile is required'),
24+
profile: z.instanceof(File, { message: 'Profile is required' }),
2925
})
3026
```
3127

0 commit comments

Comments
 (0)