Skip to content

[Bug]: WeChat gateway fails to send .html files due to MEDIA extension allowlist #29582

@NeoACCG

Description

@NeoACCG

Bug Description

This happens when sending a file through the WeChat gateway.

After commit ea49b38625b4c8ee9f8aedf6c7c3e9ec36acfe69, the shared MEDIA:<path> extraction logic in gateway/platforms/base.py::extract_media() was tightened to require a hard-coded extension allowlist.

That fixed the previous false-positive issue, but it also caused valid WeChat file attachments to be silently ignored if their extension is not included in the shared regex allowlist.

I hit this with an .html file. The agent generated / attempted to send something like:

MEDIA:/path/to/书签_分类整理_新.html

but .html was not included in the extension list, so Hermes did not extract it as an attachment for the WeChat send path.

Steps to Reproduce

Image Image

Expected Behavior

When sending files through the WeChat gateway, valid local files referenced by MEDIA:<path> should be extracted and passed to the WeChat adapter as attachments.

In this case, .html files should be sent successfully.

Actual Behavior

In the WeChat file-send flow, .html files are not recognized by extract_media() because the regex only accepts this hard-coded extension list:

png|jpe?g|gif|webp|mp4|mov|avi|mkv|webm|ogg|opus|mp3|wav|m4a|flac|epub|pdf|zip|rar|7z|docx?|xlsx?|pptx?|txt|csv|apk|ipa

As a result, the file is not handed off to the WeChat adapter as an attachment.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

/

Operating System

Ubuntu 22.04

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

Current Workaround

Locally adding html / htm to the regex extension list allowed my WeChat file-send case to work:

html?

This fixed my immediate case, but I am reporting it because the current hard-coded allowlist missed a file type that WeChat can send as a file attachment.

Related Commit

ea49b38625b4c8ee9f8aedf6c7c3e9ec36acfe69

Environment

  • Hermes Agent: current main / post-ea49b38625b4c8ee9f8aedf6c7c3e9ec36acfe69
  • Platform: WeChat gateway
  • Code path: gateway/platforms/base.py::extract_media()
  • Reproduced with: local .html file attachment via MEDIA:<path>

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/gatewayGateway runner, session dispatch, deliveryplatform/wecomWeCom / WeChat Work adaptertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions