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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
more pr fixes
Sara Vieirad7fa14b4c508
diff --git a/apps/designer/app/routes/designer/$id.tsx b/apps/designer/app/routes/designer/$id.tsxindex 3b91829e6f..03bcda0e65 100644--- a/apps/designer/app/routes/designer/$id.tsx+++ b/apps/designer/app/routes/designer/$id.tsx@@ -10,7 +10,7 @@ import { Designer, links } from "~/designer";import * as db from "~/shared/db";import config from "~/config";import env from "~/env.server";-+import { z } from "zod";export { links };export const loader: LoaderFunction = async ({ params }) => {@@ -35,10 +35,11 @@ type Error = {errors: "string";};-type ImageUpload = {- type: string;- name: string;-};+const ImageUpload = z.object({+ name: z.string(),+ type: z.string(),+});+type ImageUpload = z.infer<typeof ImageUpload>;export const action: ActionFunction = async ({ request, params }) => {if (params.id === undefined) throw new Error("Project id undefined");@@ -50,12 +51,15 @@ export const action: ActionFunction = async ({ request, params }) => {file: ({ filename }) => filename,}));- const imageInfo = formData.get("image") as ImageUpload;+ const imageInfo = formData.get("image");+ ImageUpload.parse(imageInfo);+if (imageInfo) {+ const info = imageInfo as ImageUpload;const data = {- type: imageInfo.type,- name: imageInfo.name,- path: `/uploads/${imageInfo.name}`,+ type: info.type,+ name: info.name,+ path: `/uploads/${info.name}`,};db.assets.create(params.id, data);}