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:
Jessica Rynkar
2025-08-13 12:26:59 +01:00
committed by GitHub
parent 35ca98e70e
commit 5a99d8c5f4

View File

@@ -34,6 +34,10 @@ const validate = (value) => {
return 'A file is required.'
}
if (value && (!value.name || value.name === '')) {
return 'A file name is required.'
}
return true
}