#18763: fix(slack): add auth header when downloading forwarded attachment images
channel: slack
stale
size: XS
Cluster:
Slack Media Handling Fixes
## Summary
Forwarded-message attachment images (`attachment.image_url`) are downloaded without the Slack bot token. Slack returns its HTML sign-in/redirect page (~53 KB) instead of the actual file, so every saved image is broken.
The direct-file download path at L188 already uses `createSlackMediaFetch(token)` to attach the `Authorization: Bearer` header. This PR applies the same one-liner to the attachment-image path.
### Root cause
`resolveSlackAttachmentContent()` calls `fetchRemoteMedia()` without a `fetchImpl`, so it falls back to `globalThis.fetch` which has no Slack credentials. The fix mirrors the existing pattern at L188.
### Test plan
- [x] `vitest run src/slack/monitor/media.test.ts` — 24 tests pass
- [x] `tsc --noEmit` — no new errors
Closes #18642
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds missing Slack authentication when downloading forwarded message attachment images. Previously, `attachment.image_url` downloads fell back to `globalThis.fetch` without credentials, causing Slack to return its HTML redirect page (~53KB) instead of actual image files. The fix applies the same `createSlackMediaFetch(token)` pattern already used for direct file downloads at L210.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is a minimal, well-tested bug fix that mirrors an existing working pattern in the same file. It adds only 2 lines to pass the required auth credentials, fixing a clear defect where images were broken. Tests pass and the implementation matches the established pattern at L210.
- No files require special attention
<sub>Last reviewed commit: 7fb69e4</sub>
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#14847: fix(slack): preserve auth across Slack-hosted file redirects
by natashache · 2026-02-12
86.0%
#22942: fix(slack): parse generic attachment text for inbound events
by danielalkurdi · 2026-02-21
84.5%
#20480: feat(slack): extract and surface attachment notes in messages
by olyashok · 2026-02-19
80.6%
#9166: Fix: Use userToken for Slack file downloads
by vishaltandale00 · 2026-02-04
80.0%
#15095: fix(slack): process all file attachments instead of only the first
by Lar000ki · 2026-02-13
79.7%
#4665: fix(slack): reject HTML responses when downloading media
by tumf · 2026-01-30
79.3%
#20479: fix(slack): keep replies flowing for oversized file uploads
by olyashok · 2026-02-19
79.2%
#17558: fix(slack): replace files.uploadV2 with 3-step upload flow to fix m...
by fif911 · 2026-02-15
78.2%
#9963: fix(slack): extract text from forwarded message attachments
by coreyonbreeze · 2026-02-05
77.8%
#8684: fix(slack): add title param and channel resolution for file upload
by shuans · 2026-02-04
77.6%