From 5d56820a5dec3dbbe5febeca1d293e1b5d6b0f5e Mon Sep 17 00:00:00 2001 From: Vendicated Date: Mon, 5 Jan 2026 17:31:44 +0100 Subject: [PATCH] FixImagesQuality: fix not applying to embed images --- src/plugins/fixImagesQuality/index.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/fixImagesQuality/index.tsx b/src/plugins/fixImagesQuality/index.tsx index 848cedb0..d446e421 100644 --- a/src/plugins/fixImagesQuality/index.tsx +++ b/src/plugins/fixImagesQuality/index.tsx @@ -60,12 +60,15 @@ export default definePlugin({ ); }, - getSrc(props: { src: string; mediaLayoutType: string; width: number; height: number; contentType: string; }, freeze?: boolean) { + getSrc(props: { src: string; mediaLayoutType: string; width: number; height: number; contentType: string; mosaicStyleAlt?: boolean; }, freeze?: boolean) { if (!props?.src) return; try { - const { contentType, height, mediaLayoutType, src, width } = props; - if (!contentType?.startsWith("image/") || src.startsWith("data:")) return; + const { contentType, height, mediaLayoutType, src, width, mosaicStyleAlt } = props; + // Embed images do not have a content type set. + // It's difficult to differentiate between images and videos. but mosaicStyleAlt seems exclusive to images + const isImage = contentType?.startsWith("image/") ?? (typeof mosaicStyleAlt === "boolean"); + if (!isImage || src.startsWith("data:")) return; const url = new URL(src); if (!url.pathname.startsWith("/attachments/")) return;