From fb0f20cb6412c819f3fc14a2361e2705fc510ab6 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 2 May 2023 19:22:59 -0500 Subject: [PATCH] cardSchema: drop card.pleroma from transformed type --- app/soapbox/schemas/card.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/soapbox/schemas/card.ts b/app/soapbox/schemas/card.ts index c3826fa1d..d35c9f109 100644 --- a/app/soapbox/schemas/card.ts +++ b/app/soapbox/schemas/card.ts @@ -34,23 +34,23 @@ const cardSchema = z.object({ type: z.enum(['link', 'photo', 'video', 'rich']).catch('link'), url: z.string().url(), width: z.number().catch(0), -}).transform((card) => { +}).transform(({ pleroma, ...card }) => { if (!card.provider_name) { card.provider_name = decodeIDNA(new URL(card.url).hostname); } - if (card.pleroma?.opengraph) { + if (pleroma?.opengraph) { if (!card.width && !card.height) { - card.width = card.pleroma.opengraph.width; - card.height = card.pleroma.opengraph.height; + card.width = pleroma.opengraph.width; + card.height = pleroma.opengraph.height; } if (!card.html) { - card.html = card.pleroma.opengraph.html; + card.html = pleroma.opengraph.html; } if (!card.image) { - card.image = card.pleroma.opengraph.thumbnail_url; + card.image = pleroma.opengraph.thumbnail_url; } }