From 7bbe60c57cfc1b97d52f67ccacb1d2c60782d8ba Mon Sep 17 00:00:00 2001 From: Johan Sosa Date: Tue, 19 Dec 2023 00:02:30 +0100 Subject: [PATCH] fix(FileUpload): Check if the file is an image before render it to the list --- packages/components/src/form/FileUpload/FileUpload.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/components/src/form/FileUpload/FileUpload.js b/packages/components/src/form/FileUpload/FileUpload.js index f218f70e4..5d0c3753c 100644 --- a/packages/components/src/form/FileUpload/FileUpload.js +++ b/packages/components/src/form/FileUpload/FileUpload.js @@ -103,7 +103,11 @@ const FileUpload = ({ if ('File' in window && file instanceof File && file.type.indexOf('image') >= 0) { return URL.createObjectURL(file); } - return file?.url ?? ''; + if (file?.url && file?.type?.indexOf('image') >= 0) { + return file.url; + } + + return null; }; return (