Skip to content

Commit 5a99d8c

Browse files
authored
fix: upload with no filename gives vague error (#13414)
### What? Adds validation to the file upload field to ensure a filename is provided. If the filename is missing, a clear error message is shown to the user instead of a general error. ### Why? Currently, attempting to upload a file without a filename results in a generic error message: `Something went wrong.` This makes it unclear for users to understand what the issue is. ### How? The upload field validation has been updated to explicitly check for a missing filename. If the filename is undefined or null, the error message `A filename is required` is now shown. Fixes #13410
1 parent 35ca98e commit 5a99d8c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/ui/src/elements/Upload/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ const validate = (value) => {
3434
return 'A file is required.'
3535
}
3636

37+
if (value && (!value.name || value.name === '')) {
38+
return 'A file name is required.'
39+
}
40+
3741
return true
3842
}
3943

0 commit comments

Comments
 (0)