diff --git a/src/app/features/room/message/Message.tsx b/src/app/features/room/message/Message.tsx index 78d4bf458..d6b993a18 100644 --- a/src/app/features/room/message/Message.tsx +++ b/src/app/features/room/message/Message.tsx @@ -423,10 +423,14 @@ export const MessageCopyTextItem = as< } >(({ mEvent, onClose, ...props }, ref) => { const content = mEvent.getContent(); + // Text-only: for media the `body` is the filename (or caption). We don't want + // "Copy Text" to copy a filename, so gate to textual message types. + const msgtype = content.msgtype; + const isTextual = msgtype === 'm.text' || msgtype === 'm.emote' || msgtype === 'm.notice'; const rawBody = typeof content.body === 'string' ? content.body : ''; const body = trimReplyFromBody(rawBody).trim(); - if (!body) return null; + if (!isTextual || !body) return null; const handleCopy = () => { copyToClipboard(body);