hermes - ✅(Solved) Fix Discord: inbound video attachments are rejected instead of cached [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

When a user sends a video attachment in Discord, the gateway falls through to the document handler which rejects the file as an unsupported type. The video is silently dropped and never passed to the agent.

Root Cause

The inbound attachment loop in gateway/platforms/discord.py handles image/ and audio/ content types but has no elif content_type.startswith("video/"): branch. Video falls through to the document handler, which rejects it because the extension is not in SUPPORTED_DOCUMENT_TYPES.

Fix Action

Fix

Add a video/ branch that mirrors the audio handler:

  • Primary path: att.read() (authenticated bot session) + cache_video_from_bytes
  • Fallback: aiohttp download with SSRF guard (is_safe_url) + cache_video_from_bytes
  • On any failure: fall back to the raw CDN URL (same behaviour as image/audio)

A fix is available on the branch fix/discord-inbound-video-support-v2 — single-file change to gateway/platforms/discord.py, 30 lines added.

PR fix notes

PR #13150: fix(discord): handle inbound video attachments

Description (problem / solution / changelog)

What does this PR do?

Video attachments sent to the Discord bot were silently dropped. The inbound attachment loop in discord.py handled image/ and audio/ content types but had no video/ branch — videos fell through to the document handler and were rejected as unsupported types.

This adds a video/ branch that mirrors the existing audio handler: it downloads via the authenticated bot session (att.read()), falls back to an aiohttp download with SSRF protection, caches locally using the existing cache_video_from_bytes helper, and on any failure falls back to the raw CDN URL — consistent with how image and audio failures are handled.

Related Issue

Fixes #13149

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • gateway/platforms/discord.py — added elif content_type.startswith("video/"): block in the inbound attachment loop (after audio, before document fallback). Imports cache_video_from_bytes and SUPPORTED_VIDEO_TYPES from base.py (both already existed).

How to Test

  1. Send a message with a .mp4 video attachment to the Discord bot.
  2. Confirm the agent receives it — the cached local path should appear in event.media_urls.
  3. Send a video with an unsupported extension (e.g. .3gp) and confirm it is normalised to .mp4 without crashing.
  4. Send a video when the bot session read fails (e.g. mock att.read() raising) and confirm it falls back to the CDN URL gracefully.
  5. Confirm existing image and audio attachment handling is unaffected.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(discord): handle inbound video attachments)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix (single file, 30 lines added)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu

Documentation & Housekeeping

  • I've updated relevant documentation — N/A
  • I've updated cli-config.yaml.example — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md — N/A
  • I've considered cross-platform impact — change is platform-neutral (network I/O only)
  • I've updated tool descriptions/schemas — N/A

Screenshots / Logs

Before fix: video attachment received → document handler → [Discord] Unsupported document type 'unknown', skipping

After fix: video attachment received → video handler → [Discord] Cached user video: C:\...\video_<uuid>.mp4

Changed files

  • gateway/platforms/discord.py (modified, +30/-0)
  • scripts/release.py (modified, +1/-0)
RAW_BUFFERClick to expand / collapse

Bug Report

Summary

When a user sends a video attachment in Discord, the gateway falls through to the document handler which rejects the file as an unsupported type. The video is silently dropped and never passed to the agent.

Steps to reproduce

  1. Send a message with a video attachment (e.g. .mp4) to the Discord bot.
  2. Observe that the agent receives no media — the video is not in event.media_urls.

Expected behaviour

Video attachments are downloaded, cached locally, and passed to the agent via event.media_urls — consistent with how image and audio attachments are already handled.

Root cause

The inbound attachment loop in gateway/platforms/discord.py handles image/ and audio/ content types but has no elif content_type.startswith("video/"): branch. Video falls through to the document handler, which rejects it because the extension is not in SUPPORTED_DOCUMENT_TYPES.

Fix

Add a video/ branch that mirrors the audio handler:

  • Primary path: att.read() (authenticated bot session) + cache_video_from_bytes
  • Fallback: aiohttp download with SSRF guard (is_safe_url) + cache_video_from_bytes
  • On any failure: fall back to the raw CDN URL (same behaviour as image/audio)

A fix is available on the branch fix/discord-inbound-video-support-v2 — single-file change to gateway/platforms/discord.py, 30 lines added.

extent analysis

TL;DR

To fix the issue with video attachments being silently dropped in Discord, add a video/ branch to the inbound attachment loop in gateway/platforms/discord.py to handle video content types.

Guidance

  • Verify that the issue is caused by the missing video/ branch in the inbound attachment loop by checking the content_type of the video attachment and the handling of different content types in discord.py.
  • Add an elif content_type.startswith("video/"): branch to the inbound attachment loop to handle video content types, mirroring the existing audio handler.
  • Implement the primary path for handling video attachments using att.read() and cache_video_from_bytes, and a fallback using aiohttp download with SSRF guard (is_safe_url) and cache_video_from_bytes.
  • Test the fix by sending a video attachment to the Discord bot and verifying that the video is downloaded, cached locally, and passed to the agent via event.media_urls.

Example

elif content_type.startswith("video/"):
    # Primary path: authenticated bot session
    try:
        video_bytes = att.read()
        cache_video_from_bytes(video_bytes)
    except Exception:
        # Fallback: aiohttp download with SSRF guard
        if is_safe_url(att.url):
            async with aiohttp.ClientSession() as session:
                async with session.get(att.url) as response:
                    video_bytes = await response.read()
                    cache_video_from_bytes(video_bytes)
        else:
            # Fall back to raw CDN URL
            event.media_urls.append(att.url)

Notes

The provided fix is available on the branch fix/discord-inbound-video-support-v2, which includes a single-file change to gateway/platforms/discord.py with 30 lines added.

Recommendation

Apply the workaround by adding the video/ branch to the inbound attachment loop in gateway/platforms/discord.py, as this will fix the issue with video attachments being silently dropped in Discord.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Discord: inbound video attachments are rejected instead of cached [1 pull requests]