Skip to content

Commit f0dd465

Browse files
felipapclaude
andcommitted
Skip iMessage attachments with empty paths
The iMessage SDK occasionally returns image attachments with an empty `path` (file deleted/never downloaded). Passing '' to readFile produced a stream of "ENOENT: ... open ''" warnings; filter them out before the read. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 121c7f2 commit f0dd465

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • desktop/backend/sources/imessage

desktop/backend/sources/imessage/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ export async function fetchMessages(
7070
const attachments: Attachment[] = []
7171

7272
if (includeAttachments) {
73-
// Only process image attachments - skip videos and other large files
74-
const imageAttachments = msg.attachments.filter((att) => att.isImage)
73+
// Only process image attachments - skip videos and other large files.
74+
// Some attachments come back with an empty path when the underlying
75+
// file was deleted or never downloaded; skip those without trying to
76+
// open '' (which would fail with ENOENT and spam the logs).
77+
const imageAttachments = msg.attachments.filter(
78+
(att) => att.isImage && att.path,
79+
)
7580

7681
for (const att of imageAttachments) {
7782
const readResult = await readAttachmentAsBase64(att.path, att.isImage)

0 commit comments

Comments
 (0)