fix(slack): download all files in multi-image messages#15447
Merged
steipete merged 5 commits intoopenclaw:mainfrom Feb 14, 2026
Merged
fix(slack): download all files in multi-image messages#15447steipete merged 5 commits intoopenclaw:mainfrom
steipete merged 5 commits intoopenclaw:mainfrom
Conversation
Comment on lines
+615
to
+618
| MediaTypes: | ||
| effectiveMedia && effectiveMedia.length > 0 | ||
| ? (effectiveMedia.map((m) => m.contentType).filter(Boolean) as string[]) | ||
| : undefined, |
Contributor
There was a problem hiding this comment.
Misaligned MediaTypes array
MediaTypes is built with effectiveMedia.map((m) => m.contentType).filter(Boolean), which can shorten the array compared to MediaPaths/MediaUrls when any attachment lacks a contentType. Downstream code treats these arrays as index-aligned (and in some places requires equal lengths), so this drops MIME hints for multi-attachment messages and can mis-associate types. Prefer keeping MediaTypes the same length/order as MediaPaths (e.g., preserve undefined entries) so indices remain consistent.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/slack/monitor/message-handler/prepare.ts
Line: 615:618
Comment:
**Misaligned MediaTypes array**
`MediaTypes` is built with `effectiveMedia.map((m) => m.contentType).filter(Boolean)`, which can shorten the array compared to `MediaPaths`/`MediaUrls` when any attachment lacks a `contentType`. Downstream code treats these arrays as index-aligned (and in some places requires equal lengths), so this drops MIME hints for multi-attachment messages and can mis-associate types. Prefer keeping `MediaTypes` the same length/order as `MediaPaths` (e.g., preserve `undefined` entries) so indices remain consistent.
How can I resolve this? If you propose a fix, please make it concise.e99a2ac to
d433773
Compare
steipete
added a commit
to CommanderCrowCode/openclaw
that referenced
this pull request
Feb 14, 2026
resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Urls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d433773 to
da64c9e
Compare
Contributor
|
Merged via squash.
Thanks @CommanderCrowCode! |
hamidzr
pushed a commit
to hamidzr/openclaw
that referenced
this pull request
Feb 14, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
openperf
pushed a commit
to openperf/moltbot
that referenced
this pull request
Feb 14, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
openperf
pushed a commit
to openperf/moltbot
that referenced
this pull request
Feb 14, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
BigUncle
pushed a commit
to BigUncle/openclaw
that referenced
this pull request
Feb 14, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
3 tasks
mverrilli
pushed a commit
to mverrilli/openclaw
that referenced
this pull request
Feb 14, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
GwonHyeok
pushed a commit
to learners-superpumped/openclaw
that referenced
this pull request
Feb 15, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 1, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com> (cherry picked from commit c76288b) # Conflicts: # src/slack/monitor/media.test.ts # src/slack/monitor/media.ts
This was referenced Mar 1, 2026
hughdidit
pushed a commit
to hughdidit/DAISy-Agency
that referenced
this pull request
Mar 3, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com> (cherry picked from commit c76288b) # Conflicts: # extensions/feishu/package.json # scripts/write-plugin-sdk-entry-dts.ts # src/slack/monitor/media.test.ts # src/slack/monitor/media.ts # src/slack/monitor/message-handler/prepare.ts
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
* fix(slack): download all files in multi-image messages resolveSlackMedia() previously returned after downloading the first file, causing multi-image Slack messages to lose all but the first attachment. This changes the function to collect all successfully downloaded files into an array, matching the pattern already used by Telegram, Line, Discord, and iMessage adapters. The prepare handler now populates MediaPaths, MediaUrls, and MediaTypes arrays so downstream media processing (vision, sandbox staging, media notes) works correctly with multiple attachments. Fixes openclaw#11892, openclaw#7536 * fix(slack): preserve MediaTypes index alignment with MediaPaths/MediaUrls The filter(Boolean) on MediaTypes removed entries with undefined contentType, shrinking the array and breaking index correlation with MediaPaths and MediaUrls. Downstream code (media-note.ts, attachments.ts) requires these arrays to have equal lengths for correct per-attachment MIME type lookup. Replace filter(Boolean) with a nullish coalescing fallback to "application/octet-stream". * fix(slack): align MediaType fallback and tests (openclaw#15447) (thanks @CommanderCrowCode) * fix: unblock plugin-sdk account-id typing (openclaw#15447) --------- Co-authored-by: Peter Steinberger <steipete@gmail.com>
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.
Summary
resolveSlackMedia()now collects all successfully downloaded files into an array instead of returning after the first oneprepareSlackMessage()populatesMediaPaths,MediaUrls, andMediaTypesarrays, matching the pattern used by Telegram, Line, Discord, and iMessage adaptersMediaPath/MediaType/MediaUrlfields are still populated from the first elementProblem
When a Slack user sends multiple images in a single message, only the first image is downloaded and processed. The
resolveSlackMedia()function returns immediately after the first successful file download (return { path, contentType, placeholder }), discarding all subsequent files.This is particularly impactful for use cases like nutrition logging where users photograph multiple dishes in one message.
Fixes #11892, #7536
Changes
src/slack/monitor/media.tsresolveSlackMedia()return type fromPromise<{path, contentType, placeholder} | null>toPromise<SlackMediaResult[] | null>SlackMediaResulttypesrc/slack/monitor/message-handler/prepare.tsrawBodyplaceholder: joins all file placeholders with spaceseffectiveMediacontext fields:MediaPath/MediaType/MediaUrluse first element; newMediaPaths/MediaUrls/MediaTypesarrays carry all elementssrc/slack/monitor/media.test.tsTest plan
resolveSlackMediatests pass with updated assertionsMediaPathsingular field still populated (backward compat)🤖 Generated with Claude Code
Greptile Overview
Greptile Summary
This PR updates Slack inbound media handling to support multi-file messages:
resolveSlackMedia()now downloads all successfully fetched attachments and returns them as an array, andprepareSlackMessage()populates both legacy single-value media fields and newMediaPaths/MediaUrls/MediaTypesarrays.Main issue to address before merge:
MediaTypesis currently derived with afilter(Boolean)which can shrink the array and break index alignment withMediaPaths/MediaUrls. Several downstream components treat these arrays as index-correlated (or require equal lengths), so this can cause MIME hints to be dropped or misapplied for multi-attachment messages.Confidence Score: 4/5
Last reviewed commit: ddfb393
(2/5) Greptile learns from your feedback when you react with thumbs up/down!