Fix For When user selects Empty files using File Upload ()

This commit is contained in:
Yummy-Yums 2024-04-11 22:35:15 +00:00 committed by GitHub
parent fc0be257a3
commit 6837eb8e8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -240,7 +240,13 @@ export const applyEvent = async (event, socket) => {
*/
export const applyRestEvent = async (event, socket) => {
let eventSent = false;
if (event.handler == "uploadFiles") {
if (event.handler === "uploadFiles") {
if (event.payload.files === undefined || event.payload.files.length === 0){
// Submit the event over the websocket to trigger the event handler.
return await applyEvent(Event(event.name), socket)
}
// Start upload, but do not wait for it, which would block other events.
uploadFiles(
event.name,