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
This commit is contained in:
@@ -34,6 +34,10 @@ const validate = (value) => {
|
|||||||
return 'A file is required.'
|
return 'A file is required.'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value && (!value.name || value.name === '')) {
|
||||||
|
return 'A file name is required.'
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user