Skip to content

Commit 0cd58fd

Browse files
committed
fix: properly handle attachment formatting for both simple and complex attachments
- Use comma separator for simple attachments (no text/description fields) - Use newline separator for complex attachments (with text/description fields) - Prevents malformed output when attachments span multiple lines - Fixes failing test while maintaining backward compatibility
1 parent fee3924 commit 0cd58fd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/core/src/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,10 @@ export const formatMessages = ({
273273
if (media.description) lines.push(`Description: ${media.description}`);
274274
return lines.join('\n');
275275
})
276-
.join(', ')})`
276+
.join(
277+
// Use comma separator only if all attachments are single-line (no text/description)
278+
attachments.every((media) => !media.text && !media.description) ? ', ' : '\n'
279+
)})`
277280
: null;
278281

279282
const messageTime = new Date(message.createdAt);

0 commit comments

Comments
 (0)