Merge pull request #2241 from zeroclaw-labs/supersede-pr-1923-v2-20260228

fix(channel:discord): robust inbound image marker detection
This commit is contained in:
Argenis 2026-02-28 12:10:41 -05:00 committed by GitHub
commit db16188c74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,10 +132,11 @@ fn normalize_group_reply_allowed_sender_ids(sender_ids: Vec<String>) -> Vec<Stri
/// Process Discord message attachments and return a string to append to the
/// agent message context.
///
/// `image/*` attachments are passed through as `[IMAGE:<url>]` markers so the
/// downstream model/tooling can reason about visual inputs.
/// `text/*` attachments are fetched and inlined.
/// All other types are silently skipped. Fetch errors are logged as warnings.
/// `image/*` attachments are forwarded as `[IMAGE:<url>]` markers. For
/// `application/octet-stream` or missing MIME types, image-like filename/url
/// extensions are also treated as images.
/// `text/*` MIME types are fetched and inlined. Other types are skipped.
/// Fetch errors are logged as warnings.
async fn process_attachments(
attachments: &[serde_json::Value],
client: &reqwest::Client,
@ -1646,6 +1647,7 @@ mod tests {
);
}
#[tokio::test]
async fn process_attachments_emits_image_marker_from_filename_without_content_type() {
let client = reqwest::Client::new();
let attachments = vec![serde_json::json!({