fix(msteams): fix inline pasted image downloads#10902
Closed
jlian wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(msteams): fix inline pasted image downloads#10902jlian wants to merge 1 commit intoopenclaw:mainfrom
jlian wants to merge 1 commit intoopenclaw:mainfrom
Conversation
7062e84 to
e27e7b3
Compare
bac5092 to
65dc440
Compare
4 tasks
65dc440 to
ad144dd
Compare
bfc1ccb to
f92900f
Compare
Four bugs prevented clipboard-pasted images from being received: 1. Bot Framework attachment URLs return JSON metadata, not binary content. Append /views/original to retrieve the actual image bytes. 2. trafficmanager.net was missing from DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST. 3. Inbound-media gate used every() but Teams sends mixed types for pasted images. Changed to some(). 4. downloadGraphHostedContent only read contentBytes (always null for large images). Added fallback to fetch individual hostedContents endpoint.
ad144dd to
4aac091
Compare
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Feb 18, 2026
…base) Four bugs prevented clipboard-pasted images from being received: 1. Bot Framework attachment URLs return JSON metadata, not binary content. Append /views/original to retrieve the actual image bytes. 2. trafficmanager.net was missing from DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST. 3. Inbound-media gate used every() but Teams sends mixed types for pasted images. Changed to some(). 4. downloadGraphHostedContent only read contentBytes (always null for large images). Added fallback to fetch individual hostedContents endpoint.
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Feb 19, 2026
…base) Four bugs prevented clipboard-pasted images from being received: 1. Bot Framework attachment URLs return JSON metadata, not binary content. Append /views/original to retrieve the actual image bytes. 2. trafficmanager.net was missing from DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST. 3. Inbound-media gate used every() but Teams sends mixed types for pasted images. Changed to some(). 4. downloadGraphHostedContent only read contentBytes (always null for large images). Added fallback to fetch individual hostedContents endpoint.
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Feb 19, 2026
…base) Four bugs prevented clipboard-pasted images from being received: 1. Bot Framework attachment URLs return JSON metadata, not binary content. Append /views/original to retrieve the actual image bytes. 2. trafficmanager.net was missing from DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST. 3. Inbound-media gate used every() but Teams sends mixed types for pasted images. Changed to some(). 4. downloadGraphHostedContent only read contentBytes (always null for large images). Added fallback to fetch individual hostedContents endpoint.
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Feb 20, 2026
…base) Four bugs prevented clipboard-pasted images from being received: 1. Bot Framework attachment URLs return JSON metadata, not binary content. Append /views/original to retrieve the actual image bytes. 2. trafficmanager.net was missing from DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST. 3. Inbound-media gate used every() but Teams sends mixed types for pasted images. Changed to some(). 4. downloadGraphHostedContent only read contentBytes (always null for large images). Added fallback to fetch individual hostedContents endpoint.
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Feb 20, 2026
…base) Four bugs prevented clipboard-pasted images from being received: 1. Bot Framework attachment URLs return JSON metadata, not binary content. Append /views/original to retrieve the actual image bytes. 2. trafficmanager.net was missing from DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST. 3. Inbound-media gate used every() but Teams sends mixed types for pasted images. Changed to some(). 4. downloadGraphHostedContent only read contentBytes (always null for large images). Added fallback to fetch individual hostedContents endpoint.
Contributor
|
Closing as AI-assisted stale-fix triage. Linked issue #5448 ("MSTeams: hostedContents collection response missing contentBytes - images not downloaded in group chats") is currently CLOSED and was closed on 2026-02-19T04:13:02Z with state reason NOT_PLANNED. If the underlying bug is still reproducible on current main, please reopen this PR (or open a new focused fix PR) and reference both #5448 and #10902 for fast re-triage. |
Contributor
|
Closed after AI-assisted stale-fix triage (closed issue duplicate/stale fix). |
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Feb 28, 2026
…base) Four bugs prevented clipboard-pasted images from being received: 1. Bot Framework attachment URLs return JSON metadata, not binary content. Append /views/original to retrieve the actual image bytes. 2. trafficmanager.net was missing from DEFAULT_MEDIA_AUTH_HOST_ALLOWLIST. 3. Inbound-media gate used every() but Teams sends mixed types for pasted images. Changed to some(). 4. downloadGraphHostedContent only read contentBytes (always null for large images). Added fallback to fetch individual hostedContents endpoint.
This was referenced Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
Author
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 18, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 19, 2026
jlian
added a commit
to jlian/openclaw
that referenced
this pull request
Mar 19, 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 #5448
Problem
Inline pasted images in MS Teams (clipboard paste, not drag-and-drop file attachments) were silently dropped, and the gateway never received the image bytes.
Root Cause
Four independent bugs in the MSTeams extension's media download pipeline:
1. Bot Framework attachment URLs return JSON metadata, not binary content
Teams sends pasted images as attachments with Bot Framework URLs like:
Fetching that bare URL returns a JSON metadata envelope. The binary lives at
/views/original:Fix: Added
isBotFrameworkAttachmentUrl()regex helper and/views/originalsuffix indownload.ts. Trailing slashes are stripped before appending.2.
trafficmanager.netmissing from auth host allowlistfetchWithAuthFallbackchecksDEFAULT_MEDIA_AUTH_HOST_ALLOWLISTbefore retrying with a Bearer token on 401 responses.trafficmanager.net(used bysmba.trafficmanager.netBot Framework service URLs) was not listed, so auth fallback was silently skipped.Fix: Added
trafficmanager.nettoDEFAULT_MEDIA_AUTH_HOST_ALLOWLISTinshared.ts.3. Inbound media gate required ALL attachments to be
text/htmlThe HTML-attachment gate used
every(), requiring all attachments to betext/htmlbefore triggering the Graph API fallback (Tier 2). Teams sends mixed types (image/*+text/html) for pasted images, so the condition never matched.Fix: Changed
every()→some()and renamedonlyHtmlAttachments→hasHtmlAttachmentsininbound-media.ts.4. Graph API
hostedContentscollection returnscontentBytes: nulldownloadGraphHostedContentonly readcontentBytesfrom the collection response, which is always null per Microsoft docs:The binary is available via the individual
$valueendpoint:Fix: Added
$valueendpoint fetch with Bearer auth as fallback whencontentBytesis null ingraph.ts. Kept thecontentBytesfast path in case Microsoft starts populating it in the future.Changes
extensions/msteams/src/attachments/download.tsisBotFrameworkAttachmentUrl()+/views/originalURL rewritingextensions/msteams/src/attachments/shared.tstrafficmanager.netadded to auth allowlistextensions/msteams/src/attachments/graph.ts$valueendpoint fetch for hosted contentextensions/msteams/src/monitor-handler/inbound-media.tsevery()→some()for HTML gateextensions/msteams/src/attachments.test.tsCHANGELOG.mdTesting
appends /views/original to Bot Framework attachment URLsuses auth fallback for Bot Framework 401 responsesdownloads hostedContents images via $value endpointskips hosted content when $value fetch failspnpm build && pnpm check && pnpm testall passGreptile Overview
Greptile Summary
/views/original.trafficmanager.net, enabling Bearer-token retry when Bot Framework URLs return 401/403.text/htmlattachment is present (mixed attachment types).hostedContents/{id}/$valuewhen collectioncontentBytesis null, with accompanying unit tests.Confidence Score: 5/5
(4/5) You can add custom instructions or style guidelines for the agent here!