From 4d78d427d22d9f33cd4e305b3362555b07739e07 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Fri, 10 Jul 2026 16:20:58 -0400 Subject: [PATCH] fix(message): gate "Copy Text" to textual message types Review noted media without a caption has a filename body, so Copy Text showed and copied the filename. Gate to m.text/m.emote/m.notice so it only appears for actual text messages (matching the intended behavior). Co-Authored-By: Claude Opus 4.8 --- src/app/features/room/message/Message.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);