Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

do runtime check instead of assertion

Oleg Isonencd6afefa2ffd
diff --git a/apps/designer/app/designer/shared/assets/use-assets.ts b/apps/designer/app/designer/shared/assets/use-assets.ts
index 97cd36fac9..0a3208acfc 100644
--- a/apps/designer/app/designer/shared/assets/use-assets.ts
+++ b/apps/designer/app/designer/shared/assets/use-assets.ts
@@ -48,7 +48,10 @@ const toPreviewAssets = (
const assets: Array<Promise<PreviewAsset>> = [];
for (const formData of formsData) {
for (const entry of formData) {
- const file = entry[1] as File;
+ const file = entry[1];
+ if (!(file instanceof File)) {
+ continue;
+ }
const promise: Promise<PreviewAsset> = new Promise((resolve, reject) => {
const reader = new FileReader();
reader.addEventListener("load", (event) => {