Merge pull request #94 from dialmedu/fix/paste-from-clipboard

small fix, check that dataUrls are valid
This commit is contained in:
Abi Raja 2023-11-26 15:31:13 -05:00 committed by GitHub
commit 0449fec242
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) => {
if(dataUrls.length > 0) {
setReferenceImages(dataUrls.map((dataUrl) => dataUrl as string));
}
})
.catch((error) => {
// TODO: Display error to user