From 1ea5204d8cd97818c2f33a3452f7062e19cc9ccc Mon Sep 17 00:00:00 2001 From: mybearworld <130385691+mybearworld@users.noreply.github.com> Date: Fri, 8 Nov 2024 16:02:47 +0100 Subject: [PATCH] Make the width and height optional to reflect uploads changes --- src/components/Post.tsx | 2 +- src/lib/api/posts.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Post.tsx b/src/components/Post.tsx index e48c17e..91e161e 100644 --- a/src/components/Post.tsx +++ b/src/components/Post.tsx @@ -569,7 +569,7 @@ export const AttachmentView = (props: AttachmentViewProps) => { src={`${uploads}/attachments/${props.attachment.id}/${props.attachment.filename}?preview`} alt={props.attachment.filename} title={props.attachment.filename} - height={Math.min(160, props.attachment.height)} // max-h-40 + height={Math.min(160, props.attachment.height ?? 0)} // max-h-40 /> diff --git a/src/lib/api/posts.ts b/src/lib/api/posts.ts index 0300936..7c70e60 100644 --- a/src/lib/api/posts.ts +++ b/src/lib/api/posts.ts @@ -9,11 +9,11 @@ import { USER_SCHEMA } from "./users"; export type Attachment = z.infer; const ATTACHMENT_SCHEMA = z.object({ filename: z.string(), - height: z.number(), + height: z.number().optional(), id: z.string(), mime: z.string(), size: z.number(), - width: z.number(), + width: z.number().optional(), }); type SchemaPost = z.infer & {