Add missing message attachments from attributed body - #815
Conversation
9ef2d40 to
3888691
Compare
02239c7 to
dfafb96
Compare
dfafb96 to
8793475
Compare
When attachments are requested, add any attachments referenced by file-transfer GUIDs in attributedBody that are not already present on the message. Resolve those GUIDs through the existing attachment lookup. This fixes affected group-chat image messages observed with BlueBubbles Server 1.9.9 backing a self-hosted Beeper iMessage bridge on macOS Sequoia 15.7.7, where the message/chat APIs returned attachments: [] even though the attachment GUID was present in attributedBody and resolvable by the attachment API.
8793475 to
386c756
Compare
|
I got a question. Do you know for sure if the message quite literally didn't have a corresponding |
|
Yes. For the messages I tested, the relationships were missing from the database itself. I checked SELECT COUNT(*)
FROM message_attachment_join
WHERE message_id = <affected message ROWID>;That returned I also confirmed that BlueBubbles maps For comparison, an equivalent inbound group image on macOS 26.5.1 had both the I do not know why this machine's Messages database has this shape. It could be related to the macOS version, the database's history or migration state, or something specific to this machine. I also do not know why other users have not reported the same issue. This fixes the issue for me and should not break anything for others. |
Disclosure: This change was prepared with Codex assistance.
Summary
This adds missing message attachments from file-transfer GUIDs found in
attributedBodywhen those attachments were not loaded through the normal attachment join.Observed impact
This was seen while using BlueBubbles Server
1.9.9as the local backend for a self-hosted Beeper iMessage bridge on macOS Sequoia15.7.7(24G720). In an iMessage group chat, image messages were not loading in Beeper because the BlueBubbles message/chat APIs returnedattachments: []for affected messages.For the affected message, the attachment GUID was still present in
attributedBodyunder__kIMFileTransferGUIDAttributeName, and BlueBubbles could resolve that GUID through the existing attachment endpoint. The media existed, but API consumers did not see it in the message payload.Related Issue
Fixes #816.
macOS version comparison
A comparison against a newer macOS sample (
26.5.1, build25F80) did not reproduce the missing-join shape: the same class of inbound group-chat image message had both amessage_attachment_joinrow and a file-transfer GUID inattributedBody, and BlueBubbles returned the attachment through HTTP and Socket.IO.The affected macOS
15.7.7sample differed by retaining the resolvable file-transfer GUID inattributedBodywhile omitting the normalmessage_attachment_joinrelationship. This change handles that recoverable fallback case and is a no-op when the join already loads the attachment.Changes
attributedBodythat are not already present on the message.getAttachment()lookup so attachment GUID handling stays in one place.message_attachment_join.Tested
Tested against the local BlueBubbles data on the same Mac where the Beeper bridge issue was reproduced.
1.9.9on127.0.0.1:1234: the known affected message returnedattachments: [].sh-imessagebridge queried the patched BlueBubbles endpoint directly.Validation commands run:
git diff --checknpm ci --ignore-scripts../../node_modules/.bin/eslint --ext=ts src/server/databases/imessage/index.ts --quietnpm run buildfrompackages/serverFull
npm run lint -- --quietstill fails on unrelated pre-existing lint errors outside this change.