Conversation
…ttachment Fixes xmtp#4034 createRemoteAttachment() stored url.protocol directly as the remote attachment scheme. URL.protocol includes the trailing colon (e.g. "https:"), but the rest of libxmtp's remote attachment tests and content type examples consistently use the scheme without it (e.g. "https") - bindings/node/test/RemoteAttachmentEncryption.test.ts, bindings/wasm/test/RemoteAttachmentEncryption.test.ts, bindings/wasm/test/EnrichedMessage.test.ts, and crates/xmtp_content_types/src/remote_attachment.rs. Strip the trailing colon with url.protocol.replace(/:$/, ""), matching the suggested fix in the issue. Added a regression test asserting the scheme for both https and http URLs. Verified it fails against the pre-fix code (expected 'https:' to be 'https') and passes against the fix, via a full native build (cargo build for bindings/node, then yarn build for node-sdk, since agent-sdk's test suite imports encryptAttachment from @xmtp/node-sdk which requires the compiled native binding). yarn vitest run src/util/AttachmentUtil.test.ts - 3/3 passing. yarn typecheck, eslint, and prettier clean on both changed files.
neekolas
approved these changes
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4034
createRemoteAttachment()storedurl.protocoldirectly as the remote attachment scheme.URL.protocolincludes the trailing colon (e.g."https:"), but the rest of libxmtp's remote attachment tests and content type examples consistently use the scheme without it (e.g."https") -bindings/node/test/RemoteAttachmentEncryption.test.ts,bindings/wasm/test/RemoteAttachmentEncryption.test.ts,bindings/wasm/test/EnrichedMessage.test.ts, andcrates/xmtp_content_types/src/remote_attachment.rs.Fix: strip the trailing colon with
url.protocol.replace(/:$/, ""), matching the suggested fix in the issue.Tests: added a regression test asserting the scheme for both
httpsandhttpURLs. Verified it fails against the pre-fix code (expected 'https:' to be 'https') and passes against the fix, via a full native build (cargo buildforbindings/node, thenyarn buildfornode-sdk, sinceagent-sdk's test suite importsencryptAttachmentfrom@xmtp/node-sdk, which requires the compiled native binding).Verified locally:
vitest run src/util/AttachmentUtil.test.ts- 3/3 passing,typecheck,eslint, andprettierclean on both changed files.Note
Strip trailing colon from URL scheme in
createRemoteAttachmentURL.protocolreturns a trailing colon (e.g.https:), which was being stored as the attachment scheme. The fix removes that colon so schemes likehttpsandhttpare stored cleanly. Tests now assert scheme normalization for both HTTPS and HTTP URLs.Macroscope summarized fd9db85.