Skip to content

Commit 42aa90f

Browse files
authored
Merge pull request #143 from SableClient/fix/broken-image-empty-body
Fix images with empty bodies display as broken.
2 parents 48824e3 + b66f53a commit 42aa90f

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
sable: patch
3+
---
4+
5+
Fix images without an empty body display as "Broken Message"

src/app/components/RenderMessageContent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ function RenderMessageContentInternal({
120120
);
121121

122122
const renderCaption = () => {
123+
const hasCaption = content.body && content.body.trim().length > 0;
123124
if (captionPosition === CaptionPosition.Hidden) return null;
124-
if (content.filename && content.filename !== content.body) {
125+
if (hasCaption && content.filename && content.filename !== content.body) {
125126
if (captionPosition !== CaptionPosition.Inline)
126127
return (
127128
<MText

0 commit comments

Comments
 (0)