From b59acc0dd056c8d46235c8ccf8a6e086e4c5a178 Mon Sep 17 00:00:00 2001 From: dialmedu Date: Fri, 24 Nov 2023 01:57:29 -0500 Subject: [PATCH] small fix, check that dataUrls are valid, when there is only text on the clipboard --- frontend/src/components/ImageUpload.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/ImageUpload.tsx b/frontend/src/components/ImageUpload.tsx index d3972ca..f024e2e 100644 --- a/frontend/src/components/ImageUpload.tsx +++ b/frontend/src/components/ImageUpload.tsx @@ -106,7 +106,9 @@ function ImageUpload({ setReferenceImages }: Props) { // Convert images to data URLs and set the prompt images state Promise.all(files.map((file) => fileToDataURL(file))) .then((dataUrls) => { - setReferenceImages(dataUrls.map((dataUrl) => dataUrl as string)); + if(dataUrls.length > 0) { + setReferenceImages(dataUrls.map((dataUrl) => dataUrl as string)); + } }) .catch((error) => { // TODO: Display error to user