Skip to content

Commit 76369d2

Browse files
committed
fix: update attachment payload format to use sender's public URL for direct access
1 parent 516ec5f commit 76369d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/webapp/src/hooks/use-message-sender.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,11 @@ export function useMessageSender() {
258258
targetDid,
259259
})
260260

261-
// Wire format: `local:<objectKey>` — resolved by the receiver via their own node URL.
262-
// The P2P relay (relayAttachment above) pushes the file to the receiver's ClawNet node,
263-
// so the receiver serves it at their own nodeUrl. MessageBubble.resolveAttachmentUrl()
264-
// expands this schema into a full URL at render time.
265-
const rawPayloadText = `local:${initialized.objectKey}`
261+
// Wire format: sender's public URL so the receiver can always fetch the image
262+
// directly from the sender's node — no dependency on P2P relay completing first.
263+
// P2P relay still runs in the background (triggered by targetDid in completeAttachmentUpload)
264+
// and if it succeeds the receiver's node will also have a local copy for faster future access.
265+
const rawPayloadText = `${nodeUrl.replace(/\/$/, "")}/api/v1/attachments/${encodeURIComponent(initialized.objectKey)}`
266266
const displayText = contentType === "image"
267267
? URL.createObjectURL(input.file) // local blob for sender's immediate preview
268268
: input.file.name

0 commit comments

Comments
 (0)