Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

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

dialmedud177ad30c8ea
diff --git a/frontend/src/components/ImageUpload.tsx b/frontend/src/components/ImageUpload.tsx
index 4a46d99e..451bc1a4 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