Files
cc-connect/platform
a0bcd93a88 fix(slack): improve file download error handling and auth diagnostics (#204)
When downloading Slack files via url_private_download, the code was
already setting the Bearer token correctly. However, there was no
error detection for cases where Slack returns an HTML login page
instead of the actual file content.

This commit adds:
- Fallback to url_private when url_private_download is empty
- Status code validation (fail on non-200 responses)
- HTML content detection (fail with clear error message)
- Improved error logging with redacted URL
- Unit tests for the downloadSlackFile function

The HTML detection is particularly important because when auth
fails (e.g., wrong bot token, expired token), Slack returns a
login page with HTTP 200 instead of an error code. Without this
check, the HTML content would be passed to the AI agent as if
it were an image, causing confusing errors.

Fixes #185

Co-authored-by: Shawn <shawn@chenhg5.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 15:08:53 +08:00
..