From a15dad4a3152b98bf59420f3f393feb1097557e1 Mon Sep 17 00:00:00 2001 From: Aine Date: Thu, 3 Oct 2024 01:18:45 +0300 Subject: [PATCH] ensure preview works for images only (for now) --- src/components/media.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/components/media.tsx b/src/components/media.tsx index 9fc8eed..050c6ec 100644 --- a/src/components/media.tsx +++ b/src/components/media.tsx @@ -314,7 +314,16 @@ export const QuarantineMediaButton = (props: ButtonProps) => { ); }; -export const ViewMediaButton = ({ mxcURL, label }) => { +export const ViewMediaButton = ({ mxcURL, label, mimetype }) => { + if (!mimetype.startsWith("image/")) { + return ( + <> + + {label} + + + ); + } const translate = useTranslate(); const openFileInNewTab = (blobURL: string) => { @@ -367,7 +376,7 @@ export const MediaIDField = ({ source }) => { const mxcURL = `mxc://${homeserver}/${mediaID}`; - return ; + return ; }; export const ReportMediaContent = ({ source }) => { @@ -381,5 +390,5 @@ export const ReportMediaContent = ({ source }) => { return null; } - return ; + return ; };