small fix, check that dataUrls are valid, when there is only text on the clipboard

This commit is contained in:
dialmedu 2023-11-24 01:57:29 -05:00
parent b9522fede2
commit d177ad30c8

View File

@ -106,7 +106,9 @@ function ImageUpload({ setReferenceImages }: Props) {
// Convert images to data URLs and set the prompt images state // Convert images to data URLs and set the prompt images state
Promise.all(files.map((file) => fileToDataURL(file))) Promise.all(files.map((file) => fileToDataURL(file)))
.then((dataUrls) => { .then((dataUrls) => {
if(dataUrls.length > 0) {
setReferenceImages(dataUrls.map((dataUrl) => dataUrl as string)); setReferenceImages(dataUrls.map((dataUrl) => dataUrl as string));
}
}) })
.catch((error) => { .catch((error) => {
// TODO: Display error to user // TODO: Display error to user