Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { ImageAttachmentProps } from '@rocket.chat/core-typings';
import { Box } from '@rocket.chat/fuselage';
import { useMediaUrl } from '@rocket.chat/ui-contexts';

import { useLoadImage } from './hooks/useLoadImage';
Expand Down Expand Up @@ -40,6 +41,13 @@ const ImageAttachment = ({
id={id}
alt={description}
/>

{/*Box for caption rendering*/}
{description && (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: description is rendered twice: once via MarkdownText above MessageCollapsible and again via the new <Box> inside it, causing duplicate captions for payloads with description but no descriptionMd (the mobile case this PR targets).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/client/components/message/content/attachments/file/ImageAttachment.tsx, line 46:

<comment>`description` is rendered twice: once via `MarkdownText` above `MessageCollapsible` and again via the new `<Box>` inside it, causing duplicate captions for payloads with `description` but no `descriptionMd` (the mobile case this PR targets).</comment>

<file context>
@@ -40,6 +41,13 @@ const ImageAttachment = ({
 				/>
+
+				{/*Box for caption rendering*/}
+				{description && (
+					<Box color='hint' fontScale='p2' style={{ wordBreak: 'break-word' }}>
+						{description}
</file context>

<Box color='hint' fontScale='p2' style={{ wordBreak: 'break-word' }}>
{description}
</Box>
)}
</MessageCollapsible>
</>
);
Expand Down